summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn14
-rw-r--r--core/fpdfapi/cmaps/cmap_int.h2
-rw-r--r--core/fpdfapi/cmaps/fpdf_cmaps.cpp2
-rw-r--r--core/fpdfapi/edit/cpdf_creator.cpp34
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp16
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.h4
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp43
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp22
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.h2
-rw-r--r--core/fpdfapi/font/cpdf_cmap.cpp8
-rw-r--r--core/fpdfapi/font/cpdf_cmap.h4
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.cpp4
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.h8
-rw-r--r--core/fpdfapi/font/cpdf_cmapparser.cpp16
-rw-r--r--core/fpdfapi/font/cpdf_cmapparser.h12
-rw-r--r--core/fpdfapi/font/cpdf_font.cpp30
-rw-r--r--core/fpdfapi/font/cpdf_font.h14
-rw-r--r--core/fpdfapi/font/cpdf_fontencoding.cpp6
-rw-r--r--core/fpdfapi/font/cpdf_fontencoding.h4
-rw-r--r--core/fpdfapi/font/cpdf_simplefont.cpp6
-rw-r--r--core/fpdfapi/font/cpdf_simplefont.h4
-rw-r--r--core/fpdfapi/font/cpdf_tounicodemap.cpp47
-rw-r--r--core/fpdfapi/font/cpdf_tounicodemap.h6
-rw-r--r--core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp2
-rw-r--r--core/fpdfapi/font/cpdf_truetypefont.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_allstates.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp11
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.h2
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.cpp8
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.h10
-rw-r--r--core/fpdfapi/page/cpdf_contentmarkitem.h6
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.cpp6
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.h4
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.cpp44
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.h8
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_page.h4
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.h8
-rw-r--r--core/fpdfapi/page/cpdf_psengine.cpp6
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp100
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.h29
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp40
-rw-r--r--core/fpdfapi/page/cpdf_streamparser.cpp41
-rw-r--r--core/fpdfapi/page/cpdf_streamparser.h12
-rw-r--r--core/fpdfapi/page/cpdf_textobject.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_textobject.h6
-rw-r--r--core/fpdfapi/parser/cfdf_document.cpp8
-rw-r--r--core/fpdfapi/parser/cfdf_document.h2
-rw-r--r--core/fpdfapi/parser/cpdf_array.cpp10
-rw-r--r--core/fpdfapi/parser/cpdf_array.h8
-rw-r--r--core/fpdfapi/parser/cpdf_boolean.cpp6
-rw-r--r--core/fpdfapi/parser/cpdf_boolean.h4
-rw-r--r--core/fpdfapi/parser/cpdf_crypto_handler.cpp8
-rw-r--r--core/fpdfapi/parser/cpdf_crypto_handler.h4
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp22
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.h4
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.cpp65
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.h67
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp26
-rw-r--r--core/fpdfapi/parser/cpdf_document.h2
-rw-r--r--core/fpdfapi/parser/cpdf_indirect_object_holder.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_indirect_object_holder.h4
-rw-r--r--core/fpdfapi/parser/cpdf_name.cpp11
-rw-r--r--core/fpdfapi/parser/cpdf_name.h10
-rw-r--r--core/fpdfapi/parser/cpdf_number.cpp14
-rw-r--r--core/fpdfapi/parser/cpdf_number.h6
-rw-r--r--core/fpdfapi/parser/cpdf_object.cpp10
-rw-r--r--core/fpdfapi/parser/cpdf_object.h6
-rw-r--r--core/fpdfapi/parser/cpdf_object_walker.cpp8
-rw-r--r--core/fpdfapi/parser/cpdf_object_walker.h4
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp17
-rw-r--r--core/fpdfapi/parser/cpdf_parser.h4
-rw-r--r--core/fpdfapi/parser/cpdf_reference.cpp4
-rw-r--r--core/fpdfapi/parser/cpdf_reference.h2
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.cpp70
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.h6
-rw-r--r--core/fpdfapi/parser/cpdf_simple_parser.cpp18
-rw-r--r--core/fpdfapi/parser/cpdf_simple_parser.h6
-rw-r--r--core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_stream.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_stream.h2
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.h4
-rw-r--r--core/fpdfapi/parser/cpdf_string.cpp16
-rw-r--r--core/fpdfapi/parser/cpdf_string.h14
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp61
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.h20
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.cpp24
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.h18
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp2
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.cpp20
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.h2
-rw-r--r--core/fpdfapi/render/cpdf_charposlist.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp12
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.h2
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.h2
-rw-r--r--core/fpdfdoc/cpdf_action.cpp22
-rw-r--r--core/fpdfdoc/cpdf_action.h8
-rw-r--r--core/fpdfdoc/cpdf_actionfields.cpp6
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp12
-rw-r--r--core/fpdfdoc/cpdf_annot.h5
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp4
-rw-r--r--core/fpdfdoc/cpdf_apsettings.cpp15
-rw-r--r--core/fpdfdoc/cpdf_apsettings.h18
-rw-r--r--core/fpdfdoc/cpdf_bookmark.cpp12
-rw-r--r--core/fpdfdoc/cpdf_bookmark.h2
-rw-r--r--core/fpdfdoc/cpdf_defaultappearance.cpp41
-rw-r--r--core/fpdfdoc/cpdf_defaultappearance.h15
-rw-r--r--core/fpdfdoc/cpdf_dest.cpp6
-rw-r--r--core/fpdfdoc/cpdf_dest.h2
-rw-r--r--core/fpdfdoc/cpdf_docjsactions.cpp9
-rw-r--r--core/fpdfdoc/cpdf_docjsactions.h6
-rw-r--r--core/fpdfdoc/cpdf_filespec.cpp49
-rw-r--r--core/fpdfdoc/cpdf_filespec.h8
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.cpp54
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.h26
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp118
-rw-r--r--core/fpdfdoc/cpdf_formfield.h46
-rw-r--r--core/fpdfdoc/cpdf_formfield_unittest.cpp2
-rw-r--r--core/fpdfdoc/cpdf_iconfit.cpp2
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp152
-rw-r--r--core/fpdfdoc/cpdf_interform.h31
-rw-r--r--core/fpdfdoc/cpdf_nametree.cpp49
-rw-r--r--core/fpdfdoc/cpdf_nametree.h12
-rw-r--r--core/fpdfdoc/cpdf_nametree_unittest.cpp8
-rw-r--r--core/fpdfdoc/cpdf_occontext.cpp24
-rw-r--r--core/fpdfdoc/cpdf_occontext.h2
-rw-r--r--core/fpdfdoc/cpdf_pagelabel.cpp36
-rw-r--r--core/fpdfdoc/cpdf_pagelabel.h6
-rw-r--r--core/fpdfdoc/cpdf_structelement.cpp4
-rw-r--r--core/fpdfdoc/cpdf_structelement.h8
-rw-r--r--core/fpdfdoc/cpdf_variabletext.cpp4
-rw-r--r--core/fpdfdoc/cpdf_variabletext.h2
-rw-r--r--core/fpdfdoc/cpdf_viewerpreferences.cpp8
-rw-r--r--core/fpdfdoc/cpdf_viewerpreferences.h4
-rw-r--r--core/fpdfdoc/cpvt_color.cpp4
-rw-r--r--core/fpdfdoc/cpvt_color.h2
-rw-r--r--core/fpdfdoc/cpvt_fontmap.cpp8
-rw-r--r--core/fpdfdoc/cpvt_fontmap.h10
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp153
-rw-r--r--core/fpdfdoc/cpvt_generateap.h50
-rw-r--r--core/fpdfdoc/ipdf_formnotify.h4
-rw-r--r--core/fpdfdoc/ipvt_fontmap.h2
-rw-r--r--core/fpdftext/cpdf_linkextract.cpp16
-rw-r--r--core/fpdftext/cpdf_linkextract.h10
-rw-r--r--core/fpdftext/cpdf_linkextract_unittest.cpp10
-rw-r--r--core/fpdftext/cpdf_textpage.cpp49
-rw-r--r--core/fpdftext/cpdf_textpage.h4
-rw-r--r--core/fpdftext/cpdf_textpagefind.cpp18
-rw-r--r--core/fpdftext/cpdf_textpagefind.h14
-rw-r--r--core/fxcodec/codec/ccodec_gifmodule.cpp2
-rw-r--r--core/fxcodec/codec/ccodec_pngmodule.cpp4
-rw-r--r--core/fxcodec/fx_codec.h2
-rw-r--r--core/fxcodec/lgif/cgifcontext.h2
-rw-r--r--core/fxcodec/lgif/fx_gif.cpp2
-rw-r--r--core/fxcrt/bytestring.cpp (renamed from core/fxcrt/cfx_bytestring.cpp)184
-rw-r--r--core/fxcrt/bytestring.h279
-rw-r--r--core/fxcrt/bytestring_unittest.cpp (renamed from core/fxcrt/cfx_bytestring_unittest.cpp)558
-rw-r--r--core/fxcrt/cfx_binarybuf.h2
-rw-r--r--core/fxcrt/cfx_blockbuffer.cpp10
-rw-r--r--core/fxcrt/cfx_blockbuffer.h2
-rw-r--r--core/fxcrt/cfx_bytestring.h273
-rw-r--r--core/fxcrt/cfx_checksumcontext.cpp4
-rw-r--r--core/fxcrt/cfx_checksumcontext.h6
-rw-r--r--core/fxcrt/cfx_crtfileaccess.cpp2
-rw-r--r--core/fxcrt/cfx_crtfileaccess.h4
-rw-r--r--core/fxcrt/cfx_decimal.cpp8
-rw-r--r--core/fxcrt/cfx_decimal.h4
-rw-r--r--core/fxcrt/cfx_fileaccess_posix.cpp6
-rw-r--r--core/fxcrt/cfx_fileaccess_posix.h4
-rw-r--r--core/fxcrt/cfx_fileaccess_windows.cpp4
-rw-r--r--core/fxcrt/cfx_fileaccess_windows.h4
-rw-r--r--core/fxcrt/cfx_seekablestreamproxy.cpp2
-rw-r--r--core/fxcrt/cfx_seekablestreamproxy.h2
-rw-r--r--core/fxcrt/cfx_string_pool_template.h8
-rw-r--r--core/fxcrt/cfx_string_pool_template_unittest.cpp52
-rw-r--r--core/fxcrt/cfx_utf8decoder.h2
-rw-r--r--core/fxcrt/cfx_widestring.h276
-rw-r--r--core/fxcrt/cfx_widetextbuf.cpp4
-rw-r--r--core/fxcrt/cfx_widetextbuf.h16
-rw-r--r--core/fxcrt/css/cfx_csscomputedstyle.cpp6
-rw-r--r--core/fxcrt/css/cfx_csscomputedstyle.h5
-rw-r--r--core/fxcrt/css/cfx_csscustomproperty.cpp4
-rw-r--r--core/fxcrt/css/cfx_csscustomproperty.h11
-rw-r--r--core/fxcrt/css/cfx_cssdatatable.cpp2
-rw-r--r--core/fxcrt/css/cfx_cssdatatable.h2
-rw-r--r--core/fxcrt/css/cfx_cssdeclaration.cpp32
-rw-r--r--core/fxcrt/css/cfx_cssdeclaration.h4
-rw-r--r--core/fxcrt/css/cfx_cssrulecollection.cpp2
-rw-r--r--core/fxcrt/css/cfx_cssrulecollection.h2
-rw-r--r--core/fxcrt/css/cfx_cssselector.cpp4
-rw-r--r--core/fxcrt/css/cfx_cssselector.h3
-rw-r--r--core/fxcrt/css/cfx_cssstringvalue.cpp2
-rw-r--r--core/fxcrt/css/cfx_cssstringvalue.h6
-rw-r--r--core/fxcrt/css/cfx_cssstyleselector.cpp22
-rw-r--r--core/fxcrt/css/cfx_cssstyleselector.h11
-rw-r--r--core/fxcrt/css/cfx_cssstylesheet.cpp12
-rw-r--r--core/fxcrt/css/cfx_cssstylesheet_unittest.cpp4
-rw-r--r--core/fxcrt/css/cfx_csssyntaxparser.cpp4
-rw-r--r--core/fxcrt/css/cfx_csssyntaxparser.h2
-rw-r--r--core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp40
-rw-r--r--core/fxcrt/fx_bidi.cpp2
-rw-r--r--core/fxcrt/fx_bidi.h4
-rw-r--r--core/fxcrt/fx_extension.cpp4
-rw-r--r--core/fxcrt/fx_stream.cpp10
-rw-r--r--core/fxcrt/fx_stream.h8
-rw-r--r--core/fxcrt/fx_string.cpp14
-rw-r--r--core/fxcrt/fx_string.h12
-rw-r--r--core/fxcrt/ifx_fileaccess.h4
-rw-r--r--core/fxcrt/ifx_locale.h20
-rw-r--r--core/fxcrt/string_view_template.h (renamed from core/fxcrt/cfx_string_c_template.h)83
-rw-r--r--core/fxcrt/widestring.cpp (renamed from core/fxcrt/cfx_widestring.cpp)207
-rw-r--r--core/fxcrt/widestring.h277
-rw-r--r--core/fxcrt/widestring_unittest.cpp (renamed from core/fxcrt/cfx_widestring_unittest.cpp)528
-rw-r--r--core/fxcrt/xml/cfx_saxcontext.h2
-rw-r--r--core/fxcrt/xml/cfx_saxreader.cpp18
-rw-r--r--core/fxcrt/xml/cfx_saxreader.h12
-rw-r--r--core/fxcrt/xml/cfx_saxreader_unittest.cpp12
-rw-r--r--core/fxcrt/xml/cfx_saxreaderhandler.cpp16
-rw-r--r--core/fxcrt/xml/cfx_saxreaderhandler.h12
-rw-r--r--core/fxcrt/xml/cfx_xmlattributenode.cpp15
-rw-r--r--core/fxcrt/xml/cfx_xmlattributenode.h20
-rw-r--r--core/fxcrt/xml/cfx_xmlchardata.cpp2
-rw-r--r--core/fxcrt/xml/cfx_xmlchardata.h2
-rw-r--r--core/fxcrt/xml/cfx_xmldoc.cpp34
-rw-r--r--core/fxcrt/xml/cfx_xmlelement.cpp22
-rw-r--r--core/fxcrt/xml/cfx_xmlelement.h12
-rw-r--r--core/fxcrt/xml/cfx_xmlinstruction.cpp4
-rw-r--r--core/fxcrt/xml/cfx_xmlinstruction.h10
-rw-r--r--core/fxcrt/xml/cfx_xmlnode.cpp38
-rw-r--r--core/fxcrt/xml/cfx_xmlparser.cpp2
-rw-r--r--core/fxcrt/xml/cfx_xmlparser.h4
-rw-r--r--core/fxcrt/xml/cfx_xmlsyntaxparser.cpp2
-rw-r--r--core/fxcrt/xml/cfx_xmlsyntaxparser.h12
-rw-r--r--core/fxcrt/xml/cfx_xmltext.cpp2
-rw-r--r--core/fxcrt/xml/cfx_xmltext.h8
-rw-r--r--core/fxcrt/xml/cxml_attritem.cpp4
-rw-r--r--core/fxcrt/xml/cxml_attritem.h8
-rw-r--r--core/fxcrt/xml/cxml_attrmap.cpp12
-rw-r--r--core/fxcrt/xml/cxml_attrmap.h10
-rw-r--r--core/fxcrt/xml/cxml_content.cpp2
-rw-r--r--core/fxcrt/xml/cxml_content.h4
-rw-r--r--core/fxcrt/xml/cxml_element.cpp95
-rw-r--r--core/fxcrt/xml/cxml_element.h75
-rw-r--r--core/fxcrt/xml/cxml_parser.cpp47
-rw-r--r--core/fxcrt/xml/cxml_parser.h18
-rw-r--r--core/fxge/android/cfpf_skiafont.cpp12
-rw-r--r--core/fxge/android/cfpf_skiafont.h6
-rw-r--r--core/fxge/android/cfpf_skiafontmgr.cpp30
-rw-r--r--core/fxge/android/cfpf_skiafontmgr.h8
-rw-r--r--core/fxge/android/cfx_androidfontinfo.cpp2
-rw-r--r--core/fxge/android/cfx_androidfontinfo.h2
-rw-r--r--core/fxge/apple/fx_mac_imp.cpp8
-rw-r--r--core/fxge/cfx_facecache.cpp6
-rw-r--r--core/fxge/cfx_facecache.h4
-rw-r--r--core/fxge/cfx_folderfontinfo.cpp47
-rw-r--r--core/fxge/cfx_folderfontinfo.h16
-rw-r--r--core/fxge/cfx_font.cpp24
-rw-r--r--core/fxge/cfx_fontmapper.cpp62
-rw-r--r--core/fxge/cfx_fontmapper.h22
-rw-r--r--core/fxge/cfx_fontmgr.cpp20
-rw-r--r--core/fxge/cfx_fontmgr.h8
-rw-r--r--core/fxge/cfx_renderdevice.cpp2
-rw-r--r--core/fxge/cfx_substfont.h2
-rw-r--r--core/fxge/fx_font.h28
-rw-r--r--core/fxge/fx_ge_fontmap.cpp32
-rw-r--r--core/fxge/fx_ge_linux.cpp2
-rw-r--r--core/fxge/ifx_systemfontinfo.h2
-rw-r--r--core/fxge/win32/cfx_psrenderer.cpp4
-rw-r--r--core/fxge/win32/cfx_windowsdib.h3
-rw-r--r--core/fxge/win32/cpsoutput.cpp2
-rw-r--r--core/fxge/win32/cpsoutput.h2
-rw-r--r--core/fxge/win32/fx_win32_device.cpp52
-rw-r--r--core/fxge/win32/fx_win32_dib.cpp12
-rw-r--r--core/fxge/win32/fx_win32_gdipext.cpp2
-rw-r--r--core/fxge/win32/fx_win32_print.cpp8
-rw-r--r--fpdfsdk/cba_annotiterator.cpp2
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp8
-rw-r--r--fpdfsdk/cfx_systemhandler.h4
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.cpp7
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.h5
-rw-r--r--fpdfsdk/cpdfsdk_baannot.cpp18
-rw-r--r--fpdfsdk/cpdfsdk_baannot.h12
-rw-r--r--fpdfsdk/cpdfsdk_baannothandler.cpp6
-rw-r--r--fpdfsdk/cpdfsdk_baannothandler.h5
-rw-r--r--fpdfsdk/cpdfsdk_datetime.cpp22
-rw-r--r--fpdfsdk/cpdfsdk_datetime.h8
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.cpp98
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.h24
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp67
-rw-r--r--fpdfsdk/cpdfsdk_interform.h25
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp6
-rw-r--r--fpdfsdk/cpdfsdk_pageview.h4
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp36
-rw-r--r--fpdfsdk/cpdfsdk_widget.h20
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.cpp8
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.h5
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp7
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.h5
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp27
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.h18
-rw-r--r--fpdfsdk/formfiller/cffl_combobox.cpp12
-rw-r--r--fpdfsdk/formfiller/cffl_combobox.h4
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp8
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.h4
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp14
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.h8
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp10
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.h2
-rw-r--r--fpdfsdk/fpdf_ext.cpp20
-rw-r--r--fpdfsdk/fpdf_flatten.cpp26
-rw-r--r--fpdfsdk/fpdf_structtree.cpp4
-rw-r--r--fpdfsdk/fpdf_structtree_embeddertest.cpp8
-rw-r--r--fpdfsdk/fpdf_sysfontinfo.cpp8
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp10
-rw-r--r--fpdfsdk/fpdfannot.cpp2
-rw-r--r--fpdfsdk/fpdfattachment.cpp27
-rw-r--r--fpdfsdk/fpdfdoc.cpp16
-rw-r--r--fpdfsdk/fpdfdoc_embeddertest.cpp57
-rw-r--r--fpdfsdk/fpdfedit_embeddertest.cpp4
-rw-r--r--fpdfsdk/fpdfeditimg.cpp2
-rw-r--r--fpdfsdk/fpdfeditpage.cpp2
-rw-r--r--fpdfsdk/fpdfedittext.cpp19
-rw-r--r--fpdfsdk/fpdfformfill.cpp34
-rw-r--r--fpdfsdk/fpdfformfill_embeddertest.cpp5
-rw-r--r--fpdfsdk/fpdfppo.cpp20
-rw-r--r--fpdfsdk/fpdftext.cpp16
-rw-r--r--fpdfsdk/fpdfview.cpp24
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.cpp48
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.h40
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp103
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h28
-rw-r--r--fpdfsdk/fsdk_actionhandler.cpp42
-rw-r--r--fpdfsdk/fsdk_actionhandler.h10
-rw-r--r--fpdfsdk/fsdk_define.h4
-rw-r--r--fpdfsdk/fsdk_filewriteadapter.cpp2
-rw-r--r--fpdfsdk/fsdk_filewriteadapter.h2
-rw-r--r--fpdfsdk/ipdfsdk_annothandler.h4
-rw-r--r--fpdfsdk/javascript/Annot.cpp12
-rw-r--r--fpdfsdk/javascript/Annot.h6
-rw-r--r--fpdfsdk/javascript/Document.cpp261
-rw-r--r--fpdfsdk/javascript/Document.h186
-rw-r--r--fpdfsdk/javascript/Field.cpp319
-rw-r--r--fpdfsdk/javascript/Field.h308
-rw-r--r--fpdfsdk/javascript/Icon.cpp4
-rw-r--r--fpdfsdk/javascript/Icon.h8
-rw-r--r--fpdfsdk/javascript/JS_Define.h44
-rw-r--r--fpdfsdk/javascript/JS_EventHandler.cpp36
-rw-r--r--fpdfsdk/javascript/JS_EventHandler.h44
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.cpp44
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.h26
-rw-r--r--fpdfsdk/javascript/JS_KeyValue.h4
-rw-r--r--fpdfsdk/javascript/JS_Runtime_Stub.cpp33
-rw-r--r--fpdfsdk/javascript/JS_Value.cpp27
-rw-r--r--fpdfsdk/javascript/JS_Value.h16
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp217
-rw-r--r--fpdfsdk/javascript/PublicMethods.h66
-rw-r--r--fpdfsdk/javascript/app.cpp116
-rw-r--r--fpdfsdk/javascript/app.h82
-rw-r--r--fpdfsdk/javascript/cjs_event_context.cpp29
-rw-r--r--fpdfsdk/javascript/cjs_event_context.h26
-rw-r--r--fpdfsdk/javascript/cjs_runtime.cpp11
-rw-r--r--fpdfsdk/javascript/cjs_runtime.h9
-rw-r--r--fpdfsdk/javascript/color.cpp40
-rw-r--r--fpdfsdk/javascript/color.h30
-rw-r--r--fpdfsdk/javascript/console.cpp8
-rw-r--r--fpdfsdk/javascript/console.h8
-rw-r--r--fpdfsdk/javascript/event.cpp50
-rw-r--r--fpdfsdk/javascript/event.h60
-rw-r--r--fpdfsdk/javascript/global.cpp33
-rw-r--r--fpdfsdk/javascript/global.h16
-rw-r--r--fpdfsdk/javascript/ijs_event_context.h27
-rw-r--r--fpdfsdk/javascript/ijs_runtime.h7
-rw-r--r--fpdfsdk/javascript/public_methods_embeddertest.cpp2
-rw-r--r--fpdfsdk/javascript/report.cpp4
-rw-r--r--fpdfsdk/javascript/report.h4
-rw-r--r--fpdfsdk/javascript/resource.cpp12
-rw-r--r--fpdfsdk/javascript/resource.h8
-rw-r--r--fpdfsdk/javascript/util.cpp28
-rw-r--r--fpdfsdk/javascript/util.h14
-rw-r--r--fpdfsdk/pdfsdk_fieldaction.h6
-rw-r--r--fpdfsdk/pwl/cpwl_appstream.cpp293
-rw-r--r--fpdfsdk/pwl/cpwl_appstream.h20
-rw-r--r--fpdfsdk/pwl/cpwl_button.cpp2
-rw-r--r--fpdfsdk/pwl/cpwl_button.h2
-rw-r--r--fpdfsdk/pwl/cpwl_caret.cpp2
-rw-r--r--fpdfsdk/pwl/cpwl_caret.h2
-rw-r--r--fpdfsdk/pwl/cpwl_combo_box.cpp16
-rw-r--r--fpdfsdk/pwl/cpwl_combo_box.h12
-rw-r--r--fpdfsdk/pwl/cpwl_edit.cpp20
-rw-r--r--fpdfsdk/pwl/cpwl_edit.h10
-rw-r--r--fpdfsdk/pwl/cpwl_edit_ctrl.cpp8
-rw-r--r--fpdfsdk/pwl/cpwl_edit_ctrl.h6
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.cpp38
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.h28
-rw-r--r--fpdfsdk/pwl/cpwl_font_map.cpp52
-rw-r--r--fpdfsdk/pwl/cpwl_font_map.h35
-rw-r--r--fpdfsdk/pwl/cpwl_icon.cpp6
-rw-r--r--fpdfsdk/pwl/cpwl_icon.h2
-rw-r--r--fpdfsdk/pwl/cpwl_list_box.cpp10
-rw-r--r--fpdfsdk/pwl/cpwl_list_box.h6
-rw-r--r--fpdfsdk/pwl/cpwl_list_impl.cpp12
-rw-r--r--fpdfsdk/pwl/cpwl_list_impl.h12
-rw-r--r--fpdfsdk/pwl/cpwl_scroll_bar.cpp4
-rw-r--r--fpdfsdk/pwl/cpwl_scroll_bar.h4
-rw-r--r--fpdfsdk/pwl/cpwl_special_button.cpp6
-rw-r--r--fpdfsdk/pwl/cpwl_special_button.h6
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.cpp8
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.h6
-rw-r--r--fxbarcode/BC_UtilCodingConvert.cpp37
-rw-r--r--fxbarcode/BC_UtilCodingConvert.h15
-rw-r--r--fxbarcode/BC_Utils.cpp7
-rw-r--r--fxbarcode/cbc_codabar.cpp15
-rw-r--r--fxbarcode/cbc_codabar.h4
-rw-r--r--fxbarcode/cbc_code128.cpp12
-rw-r--r--fxbarcode/cbc_code128.h4
-rw-r--r--fxbarcode/cbc_code39.cpp16
-rw-r--r--fxbarcode/cbc_code39.h4
-rw-r--r--fxbarcode/cbc_codebase.h2
-rw-r--r--fxbarcode/cbc_datamatrix.cpp4
-rw-r--r--fxbarcode/cbc_datamatrix.h2
-rw-r--r--fxbarcode/cbc_ean13.cpp18
-rw-r--r--fxbarcode/cbc_ean13.h6
-rw-r--r--fxbarcode/cbc_ean8.cpp18
-rw-r--r--fxbarcode/cbc_ean8.h6
-rw-r--r--fxbarcode/cbc_onecode.cpp4
-rw-r--r--fxbarcode/cbc_onecode.h4
-rw-r--r--fxbarcode/cbc_pdf417i.cpp4
-rw-r--r--fxbarcode/cbc_pdf417i.h2
-rw-r--r--fxbarcode/cbc_qrcode.cpp6
-rw-r--r--fxbarcode/cbc_qrcode.h2
-rw-r--r--fxbarcode/cbc_upca.cpp18
-rw-r--r--fxbarcode/cbc_upca.h6
-rw-r--r--fxbarcode/datamatrix/BC_Base256Encoder.cpp2
-rw-r--r--fxbarcode/datamatrix/BC_C40Encoder.cpp16
-rw-r--r--fxbarcode/datamatrix/BC_C40Encoder.h12
-rw-r--r--fxbarcode/datamatrix/BC_DataMatrixWriter.cpp8
-rw-r--r--fxbarcode/datamatrix/BC_DataMatrixWriter.h2
-rw-r--r--fxbarcode/datamatrix/BC_DefaultPlacement.cpp2
-rw-r--r--fxbarcode/datamatrix/BC_DefaultPlacement.h6
-rw-r--r--fxbarcode/datamatrix/BC_EdifactEncoder.cpp16
-rw-r--r--fxbarcode/datamatrix/BC_EncoderContext.cpp10
-rw-r--r--fxbarcode/datamatrix/BC_EncoderContext.h12
-rw-r--r--fxbarcode/datamatrix/BC_ErrorCorrection.cpp41
-rw-r--r--fxbarcode/datamatrix/BC_ErrorCorrection.h24
-rw-r--r--fxbarcode/datamatrix/BC_HighLevelEncoder.cpp21
-rw-r--r--fxbarcode/datamatrix/BC_HighLevelEncoder.h16
-rw-r--r--fxbarcode/datamatrix/BC_TextEncoder.cpp2
-rw-r--r--fxbarcode/datamatrix/BC_TextEncoder.h2
-rw-r--r--fxbarcode/datamatrix/BC_X12Encoder.cpp6
-rw-r--r--fxbarcode/datamatrix/BC_X12Encoder.h4
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.cpp22
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.h22
-rw-r--r--fxbarcode/oned/BC_OnedCodaBarWriter.cpp28
-rw-r--r--fxbarcode/oned/BC_OnedCodaBarWriter.h13
-rw-r--r--fxbarcode/oned/BC_OnedCode128Writer.cpp18
-rw-r--r--fxbarcode/oned/BC_OnedCode128Writer.h13
-rw-r--r--fxbarcode/oned/BC_OnedCode39Writer.cpp38
-rw-r--r--fxbarcode/oned/BC_OnedCode39Writer.h17
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.cpp20
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.h13
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.cpp19
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.h13
-rw-r--r--fxbarcode/oned/BC_OnedEANChecksum.cpp2
-rw-r--r--fxbarcode/oned/BC_OnedEANChecksum.h2
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.cpp21
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.h13
-rw-r--r--fxbarcode/pdf417/BC_PDF417.cpp14
-rw-r--r--fxbarcode/pdf417/BC_PDF417.h4
-rw-r--r--fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp4
-rw-r--r--fxbarcode/pdf417/BC_PDF417ErrorCorrection.h4
-rw-r--r--fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp37
-rw-r--r--fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h22
-rw-r--r--fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp14
-rw-r--r--fxbarcode/pdf417/BC_PDF417Writer.cpp2
-rw-r--r--fxbarcode/pdf417/BC_PDF417Writer.h2
-rw-r--r--fxbarcode/qrcode/BC_QRCodeWriter.cpp2
-rw-r--r--fxbarcode/qrcode/BC_QRCodeWriter.h2
-rw-r--r--fxbarcode/qrcode/BC_QRCoderEncoder.cpp29
-rw-r--r--fxbarcode/qrcode/BC_QRCoderEncoder.h2
-rw-r--r--fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h4
-rw-r--r--fxbarcode/qrcode/BC_QRCoderMode.cpp4
-rw-r--r--fxbarcode/qrcode/BC_QRCoderMode.h6
-rw-r--r--fxbarcode/utils.h7
-rw-r--r--fxjs/cfxjse_arguments.cpp4
-rw-r--r--fxjs/cfxjse_arguments.h2
-rw-r--r--fxjs/cfxjse_class.cpp28
-rw-r--r--fxjs/cfxjse_class.h2
-rw-r--r--fxjs/cfxjse_context.cpp2
-rw-r--r--fxjs/cfxjse_context.h2
-rw-r--r--fxjs/cfxjse_value.cpp18
-rw-r--r--fxjs/cfxjse_value.h18
-rw-r--r--fxjs/fxjs_v8.cpp42
-rw-r--r--fxjs/fxjs_v8.h23
-rw-r--r--fxjs/fxjs_v8_embeddertest.cpp10
-rw-r--r--fxjs/fxjse.h10
-rw-r--r--testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc4
-rw-r--r--testing/libfuzzer/pdf_css_fuzzer.cc4
-rw-r--r--testing/libfuzzer/pdf_fm2js_fuzzer.cc6
-rw-r--r--testing/test_support.cpp4
-rw-r--r--testing/xfa_js_embedder_test.cpp8
-rw-r--r--testing/xfa_js_embedder_test.h6
-rw-r--r--xfa/fde/cfde_texteditengine.cpp80
-rw-r--r--xfa/fde/cfde_texteditengine.h21
-rw-r--r--xfa/fde/cfde_texteditengine_unittest.cpp4
-rw-r--r--xfa/fde/cfde_textout.cpp10
-rw-r--r--xfa/fde/cfde_textout.h10
-rw-r--r--xfa/fgas/crt/cfgas_formatstring.cpp302
-rw-r--r--xfa/fgas/crt/cfgas_formatstring.h74
-rw-r--r--xfa/fgas/crt/cfgas_formatstring_unittest.cpp24
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.cpp64
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.h28
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp14
-rw-r--r--xfa/fgas/font/cfgas_gefont.h2
-rw-r--r--xfa/fgas/layout/cfx_breakline.cpp2
-rw-r--r--xfa/fgas/layout/cfx_breakline.h2
-rw-r--r--xfa/fgas/layout/cfx_breakpiece.cpp4
-rw-r--r--xfa/fgas/layout/cfx_breakpiece.h2
-rw-r--r--xfa/fgas/layout/cfx_rtfbreak.h2
-rw-r--r--xfa/fgas/layout/cfx_rtfbreak_unittest.cpp2
-rw-r--r--xfa/fgas/layout/cfx_txtbreak.h2
-rw-r--r--xfa/fwl/cfwl_barcode.cpp4
-rw-r--r--xfa/fwl/cfwl_barcode.h2
-rw-r--r--xfa/fwl/cfwl_combobox.cpp16
-rw-r--r--xfa/fwl/cfwl_combobox.h16
-rw-r--r--xfa/fwl/cfwl_combolist.cpp4
-rw-r--r--xfa/fwl/cfwl_combolist.h2
-rw-r--r--xfa/fwl/cfwl_datetimepicker.cpp8
-rw-r--r--xfa/fwl/cfwl_datetimepicker.h6
-rw-r--r--xfa/fwl/cfwl_edit.cpp28
-rw-r--r--xfa/fwl/cfwl_edit.h18
-rw-r--r--xfa/fwl/cfwl_eventcheckword.h2
-rw-r--r--xfa/fwl/cfwl_eventtextchanged.h2
-rw-r--r--xfa/fwl/cfwl_eventvalidate.h2
-rw-r--r--xfa/fwl/cfwl_form.cpp4
-rw-r--r--xfa/fwl/cfwl_form.h2
-rw-r--r--xfa/fwl/cfwl_formproxy.cpp4
-rw-r--r--xfa/fwl/cfwl_formproxy.h2
-rw-r--r--xfa/fwl/cfwl_listbox.cpp6
-rw-r--r--xfa/fwl/cfwl_listbox.h2
-rw-r--r--xfa/fwl/cfwl_listitem.cpp2
-rw-r--r--xfa/fwl/cfwl_listitem.h6
-rw-r--r--xfa/fwl/cfwl_monthcalendar.cpp32
-rw-r--r--xfa/fwl/cfwl_monthcalendar.h12
-rw-r--r--xfa/fwl/cfwl_themetext.h2
-rw-r--r--xfa/fwl/cfwl_widget.cpp6
-rw-r--r--xfa/fwl/cfwl_widget.h6
-rw-r--r--xfa/fwl/cfx_barcode.cpp2
-rw-r--r--xfa/fwl/cfx_barcode.h2
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.h2
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp8
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.h8
-rw-r--r--xfa/fxfa/cxfa_deffontmgr.cpp11
-rw-r--r--xfa/fxfa/cxfa_deffontmgr.h11
-rw-r--r--xfa/fxfa/cxfa_eventparam.h18
-rw-r--r--xfa/fxfa/cxfa_ffbarcode.cpp8
-rw-r--r--xfa/fxfa/cxfa_ffbarcode.h2
-rw-r--r--xfa/fxfa/cxfa_ffcombobox.cpp24
-rw-r--r--xfa/fxfa/cxfa_ffcombobox.h12
-rw-r--r--xfa/fxfa/cxfa_ffdatetimeedit.cpp12
-rw-r--r--xfa/fxfa/cxfa_ffdoc.cpp16
-rw-r--r--xfa/fxfa/cxfa_ffdoc.h2
-rw-r--r--xfa/fxfa/cxfa_ffdochandler.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffdochandler.h2
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp22
-rw-r--r--xfa/fxfa/cxfa_ffdocview.h6
-rw-r--r--xfa/fxfa/cxfa_fffield.cpp4
-rw-r--r--xfa/fxfa/cxfa_fflistbox.cpp9
-rw-r--r--xfa/fxfa/cxfa_fflistbox.h2
-rw-r--r--xfa/fxfa/cxfa_ffnotify.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffnotify.h2
-rw-r--r--xfa/fxfa/cxfa_ffnumericedit.cpp9
-rw-r--r--xfa/fxfa/cxfa_ffnumericedit.h2
-rw-r--r--xfa/fxfa/cxfa_ffpageview.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffpageview.h2
-rw-r--r--xfa/fxfa/cxfa_ffpasswordedit.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffpushbutton.cpp4
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp27
-rw-r--r--xfa/fxfa/cxfa_fftextedit.h8
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp34
-rw-r--r--xfa/fxfa/cxfa_ffwidget.h16
-rw-r--r--xfa/fxfa/cxfa_fontmgr.cpp23
-rw-r--r--xfa/fxfa/cxfa_fontmgr.h10
-rw-r--r--xfa/fxfa/cxfa_fwltheme.cpp4
-rw-r--r--xfa/fxfa/cxfa_fwltheme.h2
-rw-r--r--xfa/fxfa/cxfa_linkuserdata.h2
-rw-r--r--xfa/fxfa/cxfa_pdffontmgr.cpp32
-rw-r--r--xfa/fxfa/cxfa_pdffontmgr.h16
-rw-r--r--xfa/fxfa/cxfa_textlayout.cpp18
-rw-r--r--xfa/fxfa/cxfa_textlayout.h6
-rw-r--r--xfa/fxfa/cxfa_textparser.cpp46
-rw-r--r--xfa/fxfa/cxfa_textparser.h17
-rw-r--r--xfa/fxfa/cxfa_textpiece.h2
-rw-r--r--xfa/fxfa/cxfa_textprovider.cpp15
-rw-r--r--xfa/fxfa/cxfa_textprovider.h4
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp65
-rw-r--r--xfa/fxfa/cxfa_widgetacc.h12
-rw-r--r--xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp949
-rw-r--r--xfa/fxfa/fm2js/cxfa_fm2jscontext.h292
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmexpression.cpp33
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmexpression.h20
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmlexer.cpp16
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmlexer.h6
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmparser.cpp22
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmparser.h2
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmparser_unittest.cpp8
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp32
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h24
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp18
-rw-r--r--xfa/fxfa/fxfa.h54
-rw-r--r--xfa/fxfa/parser/cscript_datawindow.cpp2
-rw-r--r--xfa/fxfa/parser/cscript_eventpseudomodel.cpp8
-rw-r--r--xfa/fxfa/parser/cscript_hostpseudomodel.cpp78
-rw-r--r--xfa/fxfa/parser/cscript_hostpseudomodel.h2
-rw-r--r--xfa/fxfa/parser/cscript_layoutpseudomodel.cpp20
-rw-r--r--xfa/fxfa/parser/cscript_layoutpseudomodel.h2
-rw-r--r--xfa/fxfa/parser/cscript_logpseudomodel.cpp2
-rw-r--r--xfa/fxfa/parser/cscript_signaturepseudomodel.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_bind.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_bind.h2
-rw-r--r--xfa/fxfa/parser/cxfa_binditems.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_binditems.h8
-rw-r--r--xfa/fxfa/parser/cxfa_calculate.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_calculate.h2
-rw-r--r--xfa/fxfa/parser/cxfa_data.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_data.h2
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp72
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp42
-rw-r--r--xfa/fxfa/parser/cxfa_document.h4
-rw-r--r--xfa/fxfa/parser/cxfa_event.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_event.h4
-rw-r--r--xfa/fxfa/parser/cxfa_exdata.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_exdata.h2
-rw-r--r--xfa/fxfa/parser/cxfa_fill.cpp12
-rw-r--r--xfa/fxfa/parser/cxfa_font.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_font.h2
-rw-r--r--xfa/fxfa/parser/cxfa_image.cpp12
-rw-r--r--xfa/fxfa/parser/cxfa_image.h10
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp14
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp42
-rw-r--r--xfa/fxfa/parser/cxfa_localemgr.cpp11
-rw-r--r--xfa/fxfa/parser/cxfa_localemgr.h8
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.cpp80
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.h43
-rw-r--r--xfa/fxfa/parser/cxfa_measurement.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_measurement.h8
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp490
-rw-r--r--xfa/fxfa/parser/cxfa_node.h70
-rw-r--r--xfa/fxfa/parser/cxfa_nodehelper.cpp20
-rw-r--r--xfa/fxfa/parser/cxfa_nodehelper.h8
-rw-r--r--xfa/fxfa/parser/cxfa_nodelist.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_nodelist.h2
-rw-r--r--xfa/fxfa/parser/cxfa_nodelocale.cpp61
-rw-r--r--xfa/fxfa/parser/cxfa_nodelocale.h36
-rw-r--r--xfa/fxfa/parser/cxfa_object.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_object.h8
-rw-r--r--xfa/fxfa/parser/cxfa_resolveprocessor.cpp64
-rw-r--r--xfa/fxfa/parser/cxfa_resolveprocessor.h18
-rw-r--r--xfa/fxfa/parser/cxfa_script.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_script.h2
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.cpp89
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.h26
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp137
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.h2
-rw-r--r--xfa/fxfa/parser/cxfa_stroke.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_submit.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_submit.h4
-rw-r--r--xfa/fxfa/parser/cxfa_text.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_text.h2
-rw-r--r--xfa/fxfa/parser/cxfa_thisproxy.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_tooltip.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_tooltip.h2
-rw-r--r--xfa/fxfa/parser/cxfa_validate.cpp32
-rw-r--r--xfa/fxfa/parser/cxfa_validate.h24
-rw-r--r--xfa/fxfa/parser/cxfa_value.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_value.h2
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp209
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h62
-rw-r--r--xfa/fxfa/parser/cxfa_xmllocale.cpp92
-rw-r--r--xfa/fxfa/parser/cxfa_xmllocale.h34
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp75
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp24
-rw-r--r--xfa/fxfa/parser/xfa_utils.h16
686 files changed, 8187 insertions, 8510 deletions
diff --git a/BUILD.gn b/BUILD.gn
index b4b93b5849..8606748926 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -803,13 +803,13 @@ config("fxge_warnings") {
static_library("fxcrt") {
sources = [
+ "core/fxcrt/bytestring.cpp",
+ "core/fxcrt/bytestring.h",
"core/fxcrt/cfx_autorestorer.h",
"core/fxcrt/cfx_binarybuf.cpp",
"core/fxcrt/cfx_binarybuf.h",
"core/fxcrt/cfx_bitstream.cpp",
"core/fxcrt/cfx_bitstream.h",
- "core/fxcrt/cfx_bytestring.cpp",
- "core/fxcrt/cfx_bytestring.h",
"core/fxcrt/cfx_datetime.cpp",
"core/fxcrt/cfx_datetime.h",
"core/fxcrt/cfx_fileaccess_posix.cpp",
@@ -823,15 +823,12 @@ static_library("fxcrt") {
"core/fxcrt/cfx_observable.h",
"core/fxcrt/cfx_retain_ptr.h",
"core/fxcrt/cfx_shared_copy_on_write.h",
- "core/fxcrt/cfx_string_c_template.h",
"core/fxcrt/cfx_string_data_template.h",
"core/fxcrt/cfx_string_pool_template.h",
"core/fxcrt/cfx_unowned_ptr.h",
"core/fxcrt/cfx_utf8decoder.cpp",
"core/fxcrt/cfx_utf8decoder.h",
"core/fxcrt/cfx_weak_ptr.h",
- "core/fxcrt/cfx_widestring.cpp",
- "core/fxcrt/cfx_widestring.h",
"core/fxcrt/cfx_widetextbuf.cpp",
"core/fxcrt/cfx_widetextbuf.h",
"core/fxcrt/fx_bidi.cpp",
@@ -858,6 +855,9 @@ static_library("fxcrt") {
"core/fxcrt/fx_unicode.h",
"core/fxcrt/ifx_fileaccess.h",
"core/fxcrt/ifx_pauseindicator.h",
+ "core/fxcrt/string_view_template.h",
+ "core/fxcrt/widestring.cpp",
+ "core/fxcrt/widestring.h",
"core/fxcrt/xml/cxml_attritem.cpp",
"core/fxcrt/xml/cxml_attritem.h",
"core/fxcrt/xml/cxml_attrmap.cpp",
@@ -1917,7 +1917,7 @@ test("pdfium_unittests") {
"core/fxcodec/codec/fx_codec_rle_unittest.cpp",
"core/fxcodec/jbig2/JBig2_BitStream_unittest.cpp",
"core/fxcodec/jbig2/JBig2_Image_unittest.cpp",
- "core/fxcrt/cfx_bytestring_unittest.cpp",
+ "core/fxcrt/bytestring_unittest.cpp",
"core/fxcrt/cfx_maybe_owned_unittest.cpp",
"core/fxcrt/cfx_observable_unittest.cpp",
"core/fxcrt/cfx_retain_ptr_unittest.cpp",
@@ -1925,7 +1925,6 @@ test("pdfium_unittests") {
"core/fxcrt/cfx_string_pool_template_unittest.cpp",
"core/fxcrt/cfx_unowned_ptr_unittest.cpp",
"core/fxcrt/cfx_weak_ptr_unittest.cpp",
- "core/fxcrt/cfx_widestring_unittest.cpp",
"core/fxcrt/fx_bidi_unittest.cpp",
"core/fxcrt/fx_coordinates_unittest.cpp",
"core/fxcrt/fx_extension_unittest.cpp",
@@ -1933,6 +1932,7 @@ test("pdfium_unittests") {
"core/fxcrt/fx_random_unittest.cpp",
"core/fxcrt/fx_string_unittest.cpp",
"core/fxcrt/fx_system_unittest.cpp",
+ "core/fxcrt/widestring_unittest.cpp",
"core/fxge/dib/cstretchengine_unittest.cpp",
"fpdfsdk/fpdfdoc_unittest.cpp",
"fpdfsdk/fpdfeditimg_unittest.cpp",
diff --git a/core/fpdfapi/cmaps/cmap_int.h b/core/fpdfapi/cmaps/cmap_int.h
index e84dc11e5a..e661792843 100644
--- a/core/fpdfapi/cmaps/cmap_int.h
+++ b/core/fpdfapi/cmaps/cmap_int.h
@@ -23,7 +23,7 @@ struct FXCMAP_CMap {
int m_UseOffset;
};
-void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& name,
+void FPDFAPI_FindEmbeddedCMap(const ByteString& name,
int charset,
int coding,
const FXCMAP_CMap*& pMap);
diff --git a/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
index 80ebbdef70..01c8da9691 100644
--- a/core/fpdfapi/cmaps/fpdf_cmaps.cpp
+++ b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
@@ -53,7 +53,7 @@ static int compareDWordSingle(const void* p1, const void* p2) {
}; // extern "C"
-void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& bsName,
+void FPDFAPI_FindEmbeddedCMap(const ByteString& bsName,
int charset,
int coding,
const FXCMAP_CMap*& pMap) {
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 38a21ba0cb..c3143b5322 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -33,7 +33,7 @@ class CFX_FileBufferArchive : public IFX_ArchiveStream {
bool WriteBlock(const void* pBuf, size_t size) override;
bool WriteByte(uint8_t byte) override;
bool WriteDWord(uint32_t i) override;
- bool WriteString(const CFX_ByteStringC& str) override;
+ bool WriteString(const ByteStringView& str) override;
FX_FILESIZE CurrentOffset() const override { return offset_; }
@@ -105,7 +105,7 @@ bool CFX_FileBufferArchive::WriteDWord(uint32_t i) {
return WriteBlock(buf, static_cast<size_t>(FXSYS_strlen(buf)));
}
-bool CFX_FileBufferArchive::WriteString(const CFX_ByteStringC& str) {
+bool CFX_FileBufferArchive::WriteString(const ByteStringView& str) {
return WriteBlock(str.raw_str(), str.GetLength());
}
@@ -220,7 +220,7 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
break;
case CPDF_Object::STRING: {
- CFX_ByteString str = pObj->GetString();
+ ByteString str = pObj->GetString();
bool bHex = pObj->AsString()->IsHex();
if (!m_pCryptoHandler || !bEncrypt) {
if (!pObj->WriteTo(m_Archive.get()))
@@ -229,9 +229,9 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
}
CPDF_Encryptor encryptor(m_pCryptoHandler.Get(), objnum,
(uint8_t*)str.c_str(), str.GetLength());
- CFX_ByteString content = PDF_EncodeString(
- CFX_ByteString(encryptor.GetData(), encryptor.GetSize()), bHex);
- if (!m_Archive->WriteString(content.AsStringC()))
+ ByteString content = PDF_EncodeString(
+ ByteString(encryptor.GetData(), encryptor.GetSize()), bHex);
+ if (!m_Archive->WriteString(content.AsStringView()))
return false;
break;
}
@@ -290,10 +290,10 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
bool bSignDict = p->IsSignatureDict();
for (const auto& it : *p) {
bool bSignValue = false;
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
if (!m_Archive->WriteString("/") ||
- !m_Archive->WriteString(PDF_NameEncode(key).AsStringC())) {
+ !m_Archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return false;
}
@@ -521,11 +521,11 @@ int32_t CPDF_Creator::WriteDoc_Stage3() {
m_XrefStart = m_Archive->CurrentOffset();
if (!IsIncremental() || !m_pParser->IsXRefStream()) {
if (!IsIncremental() || m_pParser->GetLastXRefOffset() == 0) {
- CFX_ByteString str;
+ ByteString str;
str = pdfium::ContainsKey(m_ObjectOffsets, 1)
? "xref\r\n"
: "xref\r\n0 1\r\n0000000000 65535 f\r\n";
- if (!m_Archive->WriteString(str.AsStringC()))
+ if (!m_Archive->WriteString(str.AsStringView()))
return -1;
m_CurObjNum = 1;
@@ -542,7 +542,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3() {
}
}
if (m_iStage == 81) {
- CFX_ByteString str;
+ ByteString str;
uint32_t i = m_CurObjNum;
uint32_t j;
while (i <= dwLastObjNum) {
@@ -575,7 +575,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3() {
m_iStage = 90;
}
if (m_iStage == 82) {
- CFX_ByteString str;
+ ByteString str;
uint32_t iCount = pdfium::CollectionSize<uint32_t>(m_NewObjNumArray);
uint32_t i = m_CurObjNum;
while (i < iCount) {
@@ -627,7 +627,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4() {
if (m_pParser) {
CPDF_Dictionary* p = m_pParser->GetTrailer();
for (const auto& it : *p) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
if (key == "Encrypt" || key == "Size" || key == "Filter" ||
key == "Index" || key == "Length" || key == "Prev" || key == "W" ||
@@ -635,7 +635,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4() {
continue;
}
if (!m_Archive->WriteString(("/")) ||
- !m_Archive->WriteString(PDF_NameEncode(key).AsStringC())) {
+ !m_Archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return -1;
}
if (!pValue->IsInline()) {
@@ -782,7 +782,7 @@ void CPDF_Creator::InitID() {
} else {
std::vector<uint8_t> buffer =
GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
- CFX_ByteString bsBuffer(buffer.data(), buffer.size());
+ ByteString bsBuffer(buffer.data(), buffer.size());
m_pIDArray->AddNew<CPDF_String>(bsBuffer, true);
}
}
@@ -795,7 +795,7 @@ void CPDF_Creator::InitID() {
}
std::vector<uint8_t> buffer =
GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
- CFX_ByteString bsBuffer(buffer.data(), buffer.size());
+ ByteString bsBuffer(buffer.data(), buffer.size());
m_pIDArray->AddNew<CPDF_String>(bsBuffer, true);
return;
}
@@ -803,7 +803,7 @@ void CPDF_Creator::InitID() {
m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone());
if (m_pEncryptDict && !pOldIDArray && m_pParser && !idArrayPreExisting) {
if (m_pEncryptDict->GetStringFor("Filter") == "Standard") {
- CFX_ByteString user_pass = m_pParser->GetPassword();
+ ByteString user_pass = m_pParser->GetPassword();
uint32_t flag = PDF_ENCRYPT_CONTENT;
CPDF_SecurityHandler handler;
handler.OnCreate(m_pEncryptDict.Get(), m_pIDArray.get(),
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 9153bf4cea..c0c6604671 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -121,9 +121,9 @@ void CPDF_PageContentGenerator::GenerateContent() {
pStream->GetObjNum());
}
-CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
+ByteString CPDF_PageContentGenerator::RealizeResource(
uint32_t dwResourceObjNum,
- const CFX_ByteString& bsType) {
+ const ByteString& bsType) {
ASSERT(dwResourceObjNum);
if (!m_pObjHolder->m_pResources) {
m_pObjHolder->m_pResources = m_pDocument->NewIndirect<CPDF_Dictionary>();
@@ -135,7 +135,7 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
if (!pResList)
pResList = m_pObjHolder->m_pResources->SetNewFor<CPDF_Dictionary>(bsType);
- CFX_ByteString name;
+ ByteString name;
int idnum = 1;
while (1) {
name.Format("FX%c%d", bsType[0], idnum);
@@ -188,7 +188,7 @@ void CPDF_PageContentGenerator::ProcessImage(std::ostringstream* buf,
pImage->ConvertStreamToIndirectObject();
uint32_t dwObjNum = pStream->GetObjNum();
- CFX_ByteString name = RealizeResource(dwObjNum, "XObject");
+ ByteString name = RealizeResource(dwObjNum, "XObject");
if (bWasInline)
pImageObj->SetImage(m_pDocument->GetPageData()->GetImage(dwObjNum));
@@ -295,7 +295,7 @@ void CPDF_PageContentGenerator::ProcessGraphics(std::ostringstream* buf,
return;
}
- CFX_ByteString name;
+ ByteString name;
auto it = m_pObjHolder->m_GraphicsMap.find(graphD);
if (it != m_pObjHolder->m_GraphicsMap.end()) {
name = it->second;
@@ -330,7 +330,7 @@ void CPDF_PageContentGenerator::ProcessDefaultGraphics(
defaultGraphics.strokeAlpha = 1.0f;
defaultGraphics.blendType = FXDIB_BLEND_NORMAL;
auto it = m_pObjHolder->m_GraphicsMap.find(defaultGraphics);
- CFX_ByteString name;
+ ByteString name;
if (it != m_pObjHolder->m_GraphicsMap.end()) {
name = it->second;
} else {
@@ -368,7 +368,7 @@ void CPDF_PageContentGenerator::ProcessText(std::ostringstream* buf,
return;
fontD.baseFont = pFont->GetBaseFont();
auto it = m_pObjHolder->m_FontsMap.find(fontD);
- CFX_ByteString dictName;
+ ByteString dictName;
if (it != m_pObjHolder->m_FontsMap.end()) {
dictName = it->second;
} else {
@@ -387,7 +387,7 @@ void CPDF_PageContentGenerator::ProcessText(std::ostringstream* buf,
}
*buf << "/" << PDF_NameEncode(dictName) << " " << pTextObj->GetFontSize()
<< " Tf ";
- CFX_ByteString text;
+ ByteString text;
for (uint32_t charcode : pTextObj->m_CharCodes) {
if (charcode != CPDF_Font::kInvalidCharCode)
pFont->AppendChar(&text, charcode);
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
index 518d358451..433ad3361a 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
@@ -37,8 +37,8 @@ class CPDF_PageContentGenerator {
void ProcessGraphics(std::ostringstream* buf, CPDF_PageObject* pPageObj);
void ProcessDefaultGraphics(std::ostringstream* buf);
void ProcessText(std::ostringstream* buf, CPDF_TextObject* pTextObj);
- CFX_ByteString RealizeResource(uint32_t dwResourceObjNum,
- const CFX_ByteString& bsType);
+ ByteString RealizeResource(uint32_t dwResourceObjNum,
+ const ByteString& bsType);
CFX_UnownedPtr<CPDF_PageObjectHolder> const m_pObjHolder;
CFX_UnownedPtr<CPDF_Document> const m_pDocument;
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
index 1dd6d25e2a..a0db869410 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
@@ -36,8 +36,8 @@ class CPDF_PageContentGeneratorTest : public testing::Test {
}
CPDF_Dictionary* TestGetResource(CPDF_PageContentGenerator* pGen,
- const CFX_ByteString& type,
- const CFX_ByteString& name) {
+ const ByteString& type,
+ const ByteString& name) {
return pGen->m_pObjHolder->m_pResources->GetDictFor(type)->GetDictFor(name);
}
@@ -58,7 +58,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) {
CPDF_PageContentGenerator generator(pTestPage.get());
std::ostringstream buf;
TestProcessPath(&generator, &buf, pPathObj.get());
- EXPECT_EQ("q 1 0 0 1 0 0 cm 10 5 3 25 re B* Q\n", CFX_ByteString(buf));
+ EXPECT_EQ("q 1 0 0 1 0 0 cm 10 5 3 25 re B* Q\n", ByteString(buf));
pPathObj = pdfium::MakeUnique<CPDF_PathObject>();
pPathObj->m_Path.AppendPoint(CFX_PointF(0, 0), FXPT_TYPE::MoveTo, false);
@@ -71,7 +71,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) {
buf.str("");
TestProcessPath(&generator, &buf, pPathObj.get());
- EXPECT_EQ("q 1 0 0 1 0 0 cm 0 0 5.2 3.78 re n Q\n", CFX_ByteString(buf));
+ EXPECT_EQ("q 1 0 0 1 0 0 cm 0 0 5.2 3.78 re n Q\n", ByteString(buf));
}
TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) {
@@ -105,7 +105,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) {
EXPECT_EQ(
"q 1 0 0 1 0 0 cm 3.102 4.67 m 5.45 0.29 l 4.24 3.15 4.65 2.98 3.456 0.24"
" c 10.6 11.15 l 11 12.5 l 11.46 12.67 11.84 12.96 12 13.64 c h f Q\n",
- CFX_ByteString(buf));
+ ByteString(buf));
}
TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
@@ -132,7 +132,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
CPDF_PageContentGenerator generator(pTestPage.get());
std::ostringstream buf;
TestProcessPath(&generator, &buf, pPathObj.get());
- CFX_ByteString pathString(buf);
+ ByteString pathString(buf);
// Color RGB values used are integers divided by 255.
EXPECT_EQ("q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG /",
@@ -150,7 +150,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
pPathObj->m_GraphState.SetLineWidth(10.5f);
buf.str("");
TestProcessPath(&generator, &buf, pPathObj.get());
- CFX_ByteString pathString2(buf);
+ ByteString pathString2(buf);
EXPECT_EQ("q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG 10.5 w /",
pathString2.Left(55));
EXPECT_EQ(" gs 1 0 0 1 0 0 cm 1 2 m 3 4 l 5 6 l h B Q\n",
@@ -185,25 +185,25 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessStandardText) {
pTextObj->SetText("Hello World");
std::ostringstream buf;
TestProcessText(&generator, &buf, pTextObj.get());
- CFX_ByteString textString(buf);
+ ByteString textString(buf);
auto firstResourceAt = textString.Find('/');
ASSERT_TRUE(firstResourceAt.has_value());
firstResourceAt = firstResourceAt.value() + 1;
auto secondResourceAt = textString.ReverseFind('/');
ASSERT_TRUE(secondResourceAt.has_value());
secondResourceAt = secondResourceAt.value() + 1;
- CFX_ByteString firstString = textString.Left(firstResourceAt.value());
- CFX_ByteString midString =
+ ByteString firstString = textString.Left(firstResourceAt.value());
+ ByteString midString =
textString.Mid(firstResourceAt.value(),
secondResourceAt.value() - firstResourceAt.value());
- CFX_ByteString lastString =
+ ByteString lastString =
textString.Right(textString.GetLength() - secondResourceAt.value());
// q and Q must be outside the BT .. ET operations
- CFX_ByteString compareString1 =
+ ByteString compareString1 =
"q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG /";
// Color RGB values used are integers divided by 255.
- CFX_ByteString compareString2 = " gs BT 1 0 0 1 100 100 Tm /";
- CFX_ByteString compareString3 = " 10 Tf <48656C6C6F20576F726C64> Tj ET Q\n";
+ ByteString compareString2 = " gs BT 1 0 0 1 100 100 Tm /";
+ ByteString compareString3 = " 10 Tf <48656C6C6F20576F726C64> Tj ET Q\n";
EXPECT_LT(compareString1.GetLength() + compareString2.GetLength() +
compareString3.GetLength(),
textString.GetLength());
@@ -257,17 +257,16 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessText) {
TestProcessText(&generator, &buf, pTextObj.get());
}
- CFX_ByteString textString(buf);
+ ByteString textString(buf);
auto firstResourceAt = textString.Find('/');
ASSERT_TRUE(firstResourceAt.has_value());
firstResourceAt = firstResourceAt.value() + 1;
- CFX_ByteString firstString = textString.Left(firstResourceAt.value());
- CFX_ByteString lastString =
+ ByteString firstString = textString.Left(firstResourceAt.value());
+ ByteString lastString =
textString.Right(textString.GetLength() - firstResourceAt.value());
// q and Q must be outside the BT .. ET operations
- CFX_ByteString compareString1 = "q BT 1 0 0 1 0 0 Tm /";
- CFX_ByteString compareString2 =
- " 15.5 Tf <4920616D20696E646972656374> Tj ET Q\n";
+ ByteString compareString1 = "q BT 1 0 0 1 0 0 Tm /";
+ ByteString compareString2 = " 15.5 Tf <4920616D20696E646972656374> Tj ET Q\n";
EXPECT_LT(compareString1.GetLength() + compareString2.GetLength(),
textString.GetLength());
EXPECT_EQ(compareString1, textString.Left(compareString1.GetLength()));
@@ -305,7 +304,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessEmptyForm) {
CPDF_PageContentGenerator generator(pTestForm.get());
std::ostringstream buf;
generator.ProcessPageObjects(&buf);
- EXPECT_EQ("", CFX_ByteString(buf));
+ EXPECT_EQ("", ByteString(buf));
}
TEST_F(CPDF_PageContentGeneratorTest, ProcessFormWithPath) {
@@ -330,5 +329,5 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessFormWithPath) {
CPDF_PageContentGenerator generator(pTestForm.get());
std::ostringstream process_buf;
generator.ProcessPageObjects(&process_buf);
- EXPECT_EQ(content, CFX_ByteString(process_buf));
+ EXPECT_EQ(content, ByteString(process_buf));
}
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index a67abd29ac..9b326f5c4f 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -239,12 +239,12 @@ bool CPDF_CIDFont::IsVertWriting() const {
return m_pCMap && m_pCMap->IsVertWriting();
}
-CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
- CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
+WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
+ WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
if (!str.IsEmpty())
return str;
wchar_t ret = GetUnicodeFromCharCode(charcode);
- return ret ? ret : CFX_WideString();
+ return ret ? ret : WideString();
}
wchar_t CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
@@ -356,12 +356,12 @@ bool CPDF_CIDFont::Load() {
if (!pEncoding)
return false;
- CFX_ByteString subtype = pCIDFontDict->GetStringFor("Subtype");
+ ByteString subtype = pCIDFontDict->GetStringFor("Subtype");
m_bType1 = (subtype == "CIDFontType0");
CPDF_CMapManager& manager = GetFontGlobals()->m_CMapManager;
if (pEncoding->IsName()) {
- CFX_ByteString cmap = pEncoding->GetString();
+ ByteString cmap = pEncoding->GetString();
bool bPromptCJK = m_pFontFile && m_bType1;
m_pCMap = manager.GetPredefinedCMap(cmap, bPromptCJK);
if (!m_pCMap)
@@ -380,7 +380,7 @@ bool CPDF_CIDFont::Load() {
CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictFor("CIDSystemInfo");
if (pCIDInfo) {
m_Charset = CPDF_CMapParser::CharsetFromOrdering(
- pCIDInfo->GetStringFor("Ordering").AsStringC());
+ pCIDInfo->GetStringFor("Ordering").AsStringView());
}
}
if (m_Charset != CIDSET_UNKNOWN) {
@@ -621,7 +621,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
if (m_Flags & FXFONT_SYMBOLIC)
return cid;
- CFX_WideString uni_str = UnicodeFromCharCode(charcode);
+ WideString uni_str = UnicodeFromCharCode(charcode);
if (uni_str.IsEmpty())
return cid;
@@ -633,7 +633,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
if (unicode == 0)
unicode = GetUnicodeFromCharCode(charcode);
if (unicode == 0) {
- CFX_WideString unicode_str = UnicodeFromCharCode(charcode);
+ WideString unicode_str = UnicodeFromCharCode(charcode);
if (!unicode_str.IsEmpty())
unicode = unicode_str[0];
}
@@ -651,8 +651,8 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
iBaseEncoding = PDFFONT_ENCODING_WINANSI;
else if (bMacRoman)
iBaseEncoding = PDFFONT_ENCODING_MACROMAN;
- const char* name = GetAdobeCharName(
- iBaseEncoding, std::vector<CFX_ByteString>(), charcode);
+ const char* name =
+ GetAdobeCharName(iBaseEncoding, std::vector<ByteString>(), charcode);
if (!name)
return charcode ? static_cast<int>(charcode) : -1;
@@ -729,7 +729,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
}
if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmap(m_Font.GetFace())) ==
FXFT_ENCODING_UNICODE) {
- CFX_WideString unicode_str = UnicodeFromCharCode(charcode);
+ WideString unicode_str = UnicodeFromCharCode(charcode);
if (unicode_str.IsEmpty())
return -1;
diff --git a/core/fpdfapi/font/cpdf_cidfont.h b/core/fpdfapi/font/cpdf_cidfont.h
index 07982a418f..f4ddcfd577 100644
--- a/core/fpdfapi/font/cpdf_cidfont.h
+++ b/core/fpdfapi/font/cpdf_cidfont.h
@@ -54,7 +54,7 @@ class CPDF_CIDFont : public CPDF_Font {
bool IsVertWriting() const override;
bool IsUnicodeCompatible() const override;
bool Load() override;
- CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
+ WideString UnicodeFromCharCode(uint32_t charcode) const override;
uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
uint16_t CIDFromCharCode(uint32_t charcode) const;
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index 0d3745e44a..54f7b34ca0 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -248,7 +248,7 @@ CPDF_CMap::CPDF_CMap()
CPDF_CMap::~CPDF_CMap() {}
void CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
- const CFX_ByteString& bsName,
+ const ByteString& bsName,
bool bPromptCJK) {
m_PredefinedCMap = bsName;
if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") {
@@ -257,14 +257,14 @@ void CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
m_bLoaded = true;
return;
}
- CFX_ByteString cmapid = m_PredefinedCMap;
+ ByteString cmapid = m_PredefinedCMap;
m_bVertical = cmapid.Last() == 'V';
if (cmapid.GetLength() > 2) {
cmapid = cmapid.Left(cmapid.GetLength() - 2);
}
const PredefinedCMap* map = nullptr;
for (size_t i = 0; i < FX_ArraySize(g_PredefinedCMaps); ++i) {
- if (cmapid == CFX_ByteStringC(g_PredefinedCMaps[i].m_pName)) {
+ if (cmapid == ByteStringView(g_PredefinedCMaps[i].m_pName)) {
map = &g_PredefinedCMaps[i];
break;
}
@@ -295,7 +295,7 @@ void CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) {
CPDF_CMapParser parser(this);
CPDF_SimpleParser syntax(pData, size);
while (1) {
- CFX_ByteStringC word = syntax.GetWord();
+ ByteStringView word = syntax.GetWord();
if (word.IsEmpty()) {
break;
}
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h
index f4d6ca9113..3e23d03a01 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -51,7 +51,7 @@ class CPDF_CMap : public CFX_Retainable {
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
void LoadPredefined(CPDF_CMapManager* pMgr,
- const CFX_ByteString& name,
+ const ByteString& name,
bool bPromptCJK);
void LoadEmbedded(const uint8_t* pData, uint32_t dwSize);
@@ -70,7 +70,7 @@ class CPDF_CMap : public CFX_Retainable {
CPDF_CMap();
~CPDF_CMap() override;
- CFX_ByteString m_PredefinedCMap;
+ ByteString m_PredefinedCMap;
bool m_bLoaded;
bool m_bVertical;
CIDSet m_Charset;
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.cpp b/core/fpdfapi/font/cpdf_cmapmanager.cpp
index 040af5556a..a449db6a45 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.cpp
+++ b/core/fpdfapi/font/cpdf_cmapmanager.cpp
@@ -17,7 +17,7 @@ CPDF_CMapManager::CPDF_CMapManager() {}
CPDF_CMapManager::~CPDF_CMapManager() {}
CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(
- const CFX_ByteString& name,
+ const ByteString& name,
bool bPromptCJK) {
auto it = m_CMaps.find(name);
if (it != m_CMaps.end())
@@ -31,7 +31,7 @@ CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(
}
CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(
- const CFX_ByteString& name,
+ const ByteString& name,
bool bPromptCJK) {
const char* pname = name.c_str();
if (*pname == '/')
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.h b/core/fpdfapi/font/cpdf_cmapmanager.h
index 1bc1c6f839..6a860e6859 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.h
+++ b/core/fpdfapi/font/cpdf_cmapmanager.h
@@ -11,7 +11,7 @@
#include <memory>
#include "core/fpdfapi/font/cpdf_cidfont.h"
-#include "core/fxcrt/cfx_bytestring.h"
+#include "core/fxcrt/bytestring.h"
#include "core/fxcrt/cfx_retain_ptr.h"
class CPDF_CMapManager {
@@ -19,17 +19,17 @@ class CPDF_CMapManager {
CPDF_CMapManager();
~CPDF_CMapManager();
- CFX_RetainPtr<CPDF_CMap> GetPredefinedCMap(const CFX_ByteString& name,
+ CFX_RetainPtr<CPDF_CMap> GetPredefinedCMap(const ByteString& name,
bool bPromptCJK);
CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK);
private:
- CFX_RetainPtr<CPDF_CMap> LoadPredefinedCMap(const CFX_ByteString& name,
+ CFX_RetainPtr<CPDF_CMap> LoadPredefinedCMap(const ByteString& name,
bool bPromptCJK);
std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset,
bool bPromptCJK);
- std::map<CFX_ByteString, CFX_RetainPtr<CPDF_CMap>> m_CMaps;
+ std::map<ByteString, CFX_RetainPtr<CPDF_CMap>> m_CMaps;
std::unique_ptr<CPDF_CID2UnicodeMap> m_CID2UnicodeMaps[6];
};
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index 101ae5f0c8..f7d4dc1c33 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -32,9 +32,9 @@ CIDSet CIDSetFromSizeT(size_t index) {
return static_cast<CIDSet>(index);
}
-CFX_ByteStringC CMap_GetString(const CFX_ByteStringC& word) {
+ByteStringView CMap_GetString(const ByteStringView& word) {
if (word.GetLength() <= 2)
- return CFX_ByteStringC();
+ return ByteStringView();
return word.Right(word.GetLength() - 2);
}
@@ -45,7 +45,7 @@ CPDF_CMapParser::CPDF_CMapParser(CPDF_CMap* pCMap)
CPDF_CMapParser::~CPDF_CMapParser() {}
-void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
+void CPDF_CMapParser::ParseWord(const ByteStringView& word) {
if (word.IsEmpty()) {
return;
}
@@ -126,7 +126,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
}
if (m_CodeSeq % 2) {
CPDF_CMap::CodeRange range;
- if (CMap_GetCodeRange(range, m_LastWord.AsStringC(), word))
+ if (CMap_GetCodeRange(range, m_LastWord.AsStringView(), word))
m_CodeRanges.push_back(range);
}
m_CodeSeq++;
@@ -136,7 +136,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
}
// Static.
-uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
+uint32_t CPDF_CMapParser::CMap_GetCode(const ByteStringView& word) {
if (word.IsEmpty())
return 0;
pdfium::base::CheckedNumeric<uint32_t> num = 0;
@@ -160,8 +160,8 @@ uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
// Static.
bool CPDF_CMapParser::CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
- const CFX_ByteStringC& first,
- const CFX_ByteStringC& second) {
+ const ByteStringView& first,
+ const ByteStringView& second) {
if (first.GetLength() == 0 || first[0] != '<')
return false;
@@ -193,7 +193,7 @@ bool CPDF_CMapParser::CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
}
// static
-CIDSet CPDF_CMapParser::CharsetFromOrdering(const CFX_ByteStringC& ordering) {
+CIDSet CPDF_CMapParser::CharsetFromOrdering(const ByteStringView& ordering) {
for (size_t charset = 1; charset < FX_ArraySize(g_CharsetNames); ++charset) {
if (ordering == g_CharsetNames[charset])
return CIDSetFromSizeT(charset);
diff --git a/core/fpdfapi/font/cpdf_cmapparser.h b/core/fpdfapi/font/cpdf_cmapparser.h
index b0a0ced30f..b3c8326b98 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.h
+++ b/core/fpdfapi/font/cpdf_cmapparser.h
@@ -20,7 +20,7 @@ class CPDF_CMapParser {
explicit CPDF_CMapParser(CPDF_CMap* pMap);
~CPDF_CMapParser();
- void ParseWord(const CFX_ByteStringC& str);
+ void ParseWord(const ByteStringView& str);
bool HasAdditionalMappings() const {
return !m_AdditionalCharcodeToCIDMappings.empty();
}
@@ -28,16 +28,16 @@ class CPDF_CMapParser {
return std::move(m_AdditionalCharcodeToCIDMappings);
}
- static CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering);
+ static CIDSet CharsetFromOrdering(const ByteStringView& ordering);
private:
friend class cpdf_cmapparser_CMap_GetCode_Test;
friend class cpdf_cmapparser_CMap_GetCodeRange_Test;
- static uint32_t CMap_GetCode(const CFX_ByteStringC& word);
+ static uint32_t CMap_GetCode(const ByteStringView& word);
static bool CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
- const CFX_ByteStringC& first,
- const CFX_ByteStringC& second);
+ const ByteStringView& first,
+ const ByteStringView& second);
CFX_UnownedPtr<CPDF_CMap> const m_pCMap;
int m_Status;
@@ -45,7 +45,7 @@ class CPDF_CMapParser {
uint32_t m_CodePoints[4];
std::vector<CPDF_CMap::CodeRange> m_CodeRanges;
std::vector<CPDF_CMap::CIDRange> m_AdditionalCharcodeToCIDMappings;
- CFX_ByteString m_LastWord;
+ ByteString m_LastWord;
};
#endif // CORE_FPDFAPI_FONT_CPDF_CMAPPARSER_H_
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 0fd8b45326..9aaaa27b2e 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -37,7 +37,7 @@ const uint8_t kChineseFontNames[][5] = {{0xCB, 0xCE, 0xCC, 0xE5, 0x00},
{0xB7, 0xC2, 0xCB, 0xCE, 0x00},
{0xD0, 0xC2, 0xCB, 0xCE, 0x00}};
-void GetPredefinedEncoding(const CFX_ByteString& value, int* basemap) {
+void GetPredefinedEncoding(const ByteString& value, int* basemap) {
if (value == "WinAnsiEncoding")
*basemap = PDFFONT_ENCODING_WINANSI;
else if (value == "MacRomanEncoding")
@@ -140,17 +140,17 @@ int CPDF_Font::AppendChar(char* buf, uint32_t charcode) const {
return 1;
}
-void CPDF_Font::AppendChar(CFX_ByteString* str, uint32_t charcode) const {
+void CPDF_Font::AppendChar(ByteString* str, uint32_t charcode) const {
char buf[4];
int len = AppendChar(buf, charcode);
- *str += CFX_ByteStringC(buf, len);
+ *str += ByteStringView(buf, len);
}
-CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
+WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
if (!m_bToUnicodeLoaded)
LoadUnicodeMap();
- return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : CFX_WideString();
+ return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : WideString();
}
uint32_t CPDF_Font::CharCodeFromUnicode(wchar_t unicode) const {
@@ -297,8 +297,8 @@ int CPDF_Font::GetStringWidth(const char* pString, int size) {
// static
CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc,
- const CFX_ByteStringC& name) {
- CFX_ByteString fontname(name);
+ const ByteStringView& name) {
+ ByteString fontname(name);
int font_id = PDF_GetStandardFontName(&fontname);
if (font_id < 0)
return nullptr;
@@ -319,12 +319,12 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc,
std::unique_ptr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc,
CPDF_Dictionary* pFontDict) {
- CFX_ByteString type = pFontDict->GetStringFor("Subtype");
+ ByteString type = pFontDict->GetStringFor("Subtype");
std::unique_ptr<CPDF_Font> pFont;
if (type == "TrueType") {
- CFX_ByteString tag = pFontDict->GetStringFor("BaseFont").Left(4);
+ ByteString tag = pFontDict->GetStringFor("BaseFont").Left(4);
for (size_t i = 0; i < FX_ArraySize(kChineseFontNames); ++i) {
- if (tag == CFX_ByteString(kChineseFontNames[i], 4)) {
+ if (tag == ByteString(kChineseFontNames[i], 4)) {
CPDF_Dictionary* pFontDesc = pFontDict->GetDictFor("FontDescriptor");
if (!pFontDesc || !pFontDesc->KeyExist("FontFile2"))
pFont = pdfium::MakeUnique<CPDF_CIDFont>();
@@ -358,7 +358,7 @@ uint32_t CPDF_Font::GetNextChar(const char* pString,
void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
int& iBaseEncoding,
- std::vector<CFX_ByteString>* pCharNames,
+ std::vector<ByteString>* pCharNames,
bool bEmbedded,
bool bTrueType) {
if (!pEncoding) {
@@ -380,7 +380,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
return;
}
- CFX_ByteString bsEncoding = pEncoding->GetString();
+ ByteString bsEncoding = pEncoding->GetString();
if (bsEncoding.Compare("MacExpertEncoding") == 0) {
bsEncoding = "WinAnsiEncoding";
}
@@ -394,7 +394,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
if (iBaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL &&
iBaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS) {
- CFX_ByteString bsEncoding = pDict->GetStringFor("BaseEncoding");
+ ByteString bsEncoding = pDict->GetStringFor("BaseEncoding");
if (bsEncoding.Compare("MacExpertEncoding") == 0 && bTrueType) {
bsEncoding = "WinAnsiEncoding";
}
@@ -436,7 +436,7 @@ bool CPDF_Font::IsStandardFont() const {
const char* CPDF_Font::GetAdobeCharName(
int iBaseEncoding,
- const std::vector<CFX_ByteString>& charnames,
+ const std::vector<ByteString>& charnames,
int charcode) {
if (charcode < 0 || charcode >= 256) {
NOTREACHED();
@@ -466,7 +466,7 @@ int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode) {
if (!pdfium::IndexInBounds(m_FontFallbacks, fallbackFont))
return -1;
- CFX_WideString str = UnicodeFromCharCode(charcode);
+ WideString str = UnicodeFromCharCode(charcode);
uint32_t unicode = !str.IsEmpty() ? str[0] : charcode;
int glyph =
FXFT_Get_Char_Index(m_FontFallbacks[fallbackFont]->GetFace(), unicode);
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index f70542223c..e92e2f24e5 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -32,7 +32,7 @@ class CPDF_Font {
static std::unique_ptr<CPDF_Font> Create(CPDF_Document* pDoc,
CPDF_Dictionary* pFontDict);
static CPDF_Font* GetStockFont(CPDF_Document* pDoc,
- const CFX_ByteStringC& fontname);
+ const ByteStringView& fontname);
static const uint32_t kInvalidCharCode = static_cast<uint32_t>(-1);
virtual ~CPDF_Font();
@@ -59,17 +59,17 @@ class CPDF_Font {
virtual int AppendChar(char* buf, uint32_t charcode) const;
virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0;
virtual int GlyphFromCharCodeExt(uint32_t charcode);
- virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const;
+ virtual WideString UnicodeFromCharCode(uint32_t charcode) const;
virtual uint32_t CharCodeFromUnicode(wchar_t Unicode) const;
virtual bool HasFontWidths() const;
- const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
+ const ByteString& GetBaseFont() const { return m_BaseFont; }
CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
bool IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
bool IsStandardFont() const;
FXFT_Face GetFace() const { return m_Font.GetFace(); }
- void AppendChar(CFX_ByteString* str, uint32_t charcode) const;
+ void AppendChar(ByteString* str, uint32_t charcode) const;
void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
int GetTypeAscent() const { return m_Ascent; }
@@ -97,20 +97,20 @@ class CPDF_Font {
void LoadUnicodeMap() const; // logically const only.
void LoadPDFEncoding(CPDF_Object* pEncoding,
int& iBaseEncoding,
- std::vector<CFX_ByteString>* pCharNames,
+ std::vector<ByteString>* pCharNames,
bool bEmbedded,
bool bTrueType);
void LoadFontDescriptor(CPDF_Dictionary* pDict);
void CheckFontMetrics();
const char* GetAdobeCharName(int iBaseEncoding,
- const std::vector<CFX_ByteString>& charnames,
+ const std::vector<ByteString>& charnames,
int charcode);
CFX_UnownedPtr<CPDF_Document> m_pDocument;
CFX_Font m_Font;
std::vector<std::unique_ptr<CFX_Font>> m_FontFallbacks;
- CFX_ByteString m_BaseFont;
+ ByteString m_BaseFont;
CFX_RetainPtr<CPDF_StreamAcc> m_pFontFile;
CPDF_Dictionary* m_pFontDict;
mutable std::unique_ptr<CPDF_ToUnicodeMap> m_pToUnicodeMap;
diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp
index 2cc6445ab2..6290f20f5e 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/font/cpdf_fontencoding.cpp
@@ -1672,7 +1672,7 @@ bool CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const {
}
std::unique_ptr<CPDF_Object> CPDF_FontEncoding::Realize(
- CFX_WeakPtr<CFX_ByteStringPool> pPool) {
+ CFX_WeakPtr<ByteStringPool> pPool) {
int predefined = 0;
for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS;
cs++) {
@@ -1761,10 +1761,10 @@ wchar_t PDF_UnicodeFromAdobeName(const char* name) {
return (wchar_t)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF);
}
-CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) {
+ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) {
char glyph_name[64];
FXFT_adobe_name_from_unicode(glyph_name, unicode);
- return CFX_ByteString(glyph_name);
+ return ByteString(glyph_name);
}
const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) {
diff --git a/core/fpdfapi/font/cpdf_fontencoding.h b/core/fpdfapi/font/cpdf_fontencoding.h
index 7a94db9f0e..075cc04c7c 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.h
+++ b/core/fpdfapi/font/cpdf_fontencoding.h
@@ -28,7 +28,7 @@ uint32_t FT_CharCodeFromUnicode(int encoding, wchar_t unicode);
wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode);
wchar_t PDF_UnicodeFromAdobeName(const char* name);
-CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode);
+ByteString PDF_AdobeNameFromUnicode(wchar_t unicode);
const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding);
const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode);
@@ -53,7 +53,7 @@ class CPDF_FontEncoding {
m_Unicodes[charcode] = unicode;
}
- std::unique_ptr<CPDF_Object> Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool);
+ std::unique_ptr<CPDF_Object> Realize(CFX_WeakPtr<ByteStringPool> pPool);
public:
wchar_t m_Unicodes[256];
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index 56a4b13cb3..ccf514db07 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -196,13 +196,13 @@ bool CPDF_SimpleFont::IsUnicodeCompatible() const {
m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS;
}
-CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
- CFX_WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
+WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
+ WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
if (!unicode.IsEmpty())
return unicode;
wchar_t ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode);
if (ret == 0)
- return CFX_WideString();
+ return WideString();
return ret;
}
diff --git a/core/fpdfapi/font/cpdf_simplefont.h b/core/fpdfapi/font/cpdf_simplefont.h
index 6a22f46966..5291211b24 100644
--- a/core/fpdfapi/font/cpdf_simplefont.h
+++ b/core/fpdfapi/font/cpdf_simplefont.h
@@ -24,7 +24,7 @@ class CPDF_SimpleFont : public CPDF_Font {
FX_RECT GetCharBBox(uint32_t charcode) override;
int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
bool IsUnicodeCompatible() const override;
- CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
+ WideString UnicodeFromCharCode(uint32_t charcode) const override;
uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
CPDF_FontEncoding* GetEncoding() { return &m_Encoding; }
@@ -41,7 +41,7 @@ class CPDF_SimpleFont : public CPDF_Font {
CPDF_FontEncoding m_Encoding;
uint16_t m_GlyphIndex[256];
uint16_t m_ExtGID[256];
- std::vector<CFX_ByteString> m_CharNames;
+ std::vector<ByteString> m_CharNames;
int m_BaseEncoding;
uint16_t m_CharWidth[256];
FX_RECT m_CharBBox[256];
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.cpp b/core/fpdfapi/font/cpdf_tounicodemap.cpp
index 9076f4a737..354f5061c3 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap.cpp
@@ -14,7 +14,7 @@
#include "core/fxcrt/fx_safe_types.h"
#include "third_party/base/numerics/safe_conversions.h"
-CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
+WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
auto it = m_Map.find(charcode);
if (it != m_Map.end()) {
uint32_t value = it->second;
@@ -25,22 +25,22 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
const wchar_t* buf = m_MultiCharBuf.GetBuffer();
uint32_t buf_len = m_MultiCharBuf.GetLength();
if (!buf || buf_len == 0) {
- return CFX_WideString();
+ return WideString();
}
uint32_t index = value >> 16;
if (index >= buf_len) {
- return CFX_WideString();
+ return WideString();
}
uint32_t len = buf[index];
if (index + len < index || index + len >= buf_len) {
- return CFX_WideString();
+ return WideString();
}
- return CFX_WideString(buf + index + 1, len);
+ return WideString(buf + index + 1, len);
}
if (m_pBaseMap) {
return m_pBaseMap->UnicodeFromCID((uint16_t)charcode);
}
- return CFX_WideString();
+ return WideString();
}
uint32_t CPDF_ToUnicodeMap::ReverseLookup(wchar_t unicode) const {
@@ -52,7 +52,7 @@ uint32_t CPDF_ToUnicodeMap::ReverseLookup(wchar_t unicode) const {
}
// Static.
-uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
+uint32_t CPDF_ToUnicodeMap::StringToCode(const ByteStringView& str) {
int len = str.GetLength();
if (len == 0)
return 0;
@@ -70,8 +70,8 @@ uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
return result;
}
-static CFX_WideString StringDataAdd(CFX_WideString str) {
- CFX_WideString ret;
+static WideString StringDataAdd(WideString str) {
+ WideString ret;
int len = str.GetLength();
wchar_t value = 1;
for (int i = len - 1; i >= 0; --i) {
@@ -89,13 +89,12 @@ static CFX_WideString StringDataAdd(CFX_WideString str) {
}
// Static.
-CFX_WideString CPDF_ToUnicodeMap::StringToWideString(
- const CFX_ByteStringC& str) {
+WideString CPDF_ToUnicodeMap::StringToWideString(const ByteStringView& str) {
int len = str.GetLength();
if (len == 0)
- return CFX_WideString();
+ return WideString();
- CFX_WideString result;
+ WideString result;
if (str[0] == '<') {
int byte_pos = 0;
wchar_t ch = 0;
@@ -129,7 +128,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
pAcc->LoadAllData(false);
CPDF_SimpleParser parser(pAcc->GetData(), pAcc->GetSize());
while (1) {
- CFX_ByteStringC word = parser.GetWord();
+ ByteStringView word = parser.GetWord();
if (word.IsEmpty()) {
break;
}
@@ -141,7 +140,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
}
uint32_t srccode = StringToCode(word);
word = parser.GetWord();
- CFX_WideString destcode = StringToWideString(word);
+ WideString destcode = StringToWideString(word);
int len = destcode.GetLength();
if (len == 0) {
continue;
@@ -156,23 +155,23 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
}
} else if (word == "beginbfrange") {
while (1) {
- CFX_ByteString low, high;
+ ByteString low, high;
low = parser.GetWord();
if (low.IsEmpty() || low == "endbfrange") {
break;
}
high = parser.GetWord();
- uint32_t lowcode = StringToCode(low.AsStringC());
+ uint32_t lowcode = StringToCode(low.AsStringView());
uint32_t highcode =
- (lowcode & 0xffffff00) | (StringToCode(high.AsStringC()) & 0xff);
+ (lowcode & 0xffffff00) | (StringToCode(high.AsStringView()) & 0xff);
if (highcode == (uint32_t)-1) {
break;
}
- CFX_ByteString start(parser.GetWord());
+ ByteString start(parser.GetWord());
if (start == "[") {
for (uint32_t code = lowcode; code <= highcode; code++) {
- CFX_ByteString dest(parser.GetWord());
- CFX_WideString destcode = StringToWideString(dest.AsStringC());
+ ByteString dest(parser.GetWord());
+ WideString destcode = StringToWideString(dest.AsStringView());
int len = destcode.GetLength();
if (len == 0) {
continue;
@@ -187,17 +186,17 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
}
parser.GetWord();
} else {
- CFX_WideString destcode = StringToWideString(start.AsStringC());
+ WideString destcode = StringToWideString(start.AsStringView());
int len = destcode.GetLength();
uint32_t value = 0;
if (len == 1) {
- value = StringToCode(start.AsStringC());
+ value = StringToCode(start.AsStringView());
for (uint32_t code = lowcode; code <= highcode; code++) {
m_Map[code] = value++;
}
} else {
for (uint32_t code = lowcode; code <= highcode; code++) {
- CFX_WideString retcode;
+ WideString retcode;
if (code == lowcode) {
retcode = destcode;
} else {
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.h b/core/fpdfapi/font/cpdf_tounicodemap.h
index 90a2638462..4e11140e75 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.h
+++ b/core/fpdfapi/font/cpdf_tounicodemap.h
@@ -22,15 +22,15 @@ class CPDF_ToUnicodeMap {
void Load(CPDF_Stream* pStream);
- CFX_WideString Lookup(uint32_t charcode) const;
+ WideString Lookup(uint32_t charcode) const;
uint32_t ReverseLookup(wchar_t unicode) const;
private:
friend class cpdf_tounicodemap_StringToCode_Test;
friend class cpdf_tounicodemap_StringToWideString_Test;
- static uint32_t StringToCode(const CFX_ByteStringC& str);
- static CFX_WideString StringToWideString(const CFX_ByteStringC& str);
+ static uint32_t StringToCode(const ByteStringView& str);
+ static WideString StringToWideString(const ByteStringView& str);
uint32_t GetUnicode();
diff --git a/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp b/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp
index 299f4d9b1e..4a5dc25a4c 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp
@@ -21,7 +21,7 @@ TEST(cpdf_tounicodemap, StringToWideString) {
EXPECT_EQ(L"", CPDF_ToUnicodeMap::StringToWideString("<c2"));
- CFX_WideString res = L"\xc2ab";
+ WideString res = L"\xc2ab";
EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2ab"));
EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2abab"));
EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2ab 1234"));
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index 5fde64693a..a0542ecba4 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -137,7 +137,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
continue;
- CFX_WideString wsUnicode = UnicodeFromCharCode(charcode);
+ WideString wsUnicode = UnicodeFromCharCode(charcode);
if (!wsUnicode.IsEmpty()) {
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), wsUnicode[0]);
diff --git a/core/fpdfapi/page/cpdf_allstates.cpp b/core/fpdfapi/page/cpdf_allstates.cpp
index cedc8479bc..afc87a2b5a 100644
--- a/core/fpdfapi/page/cpdf_allstates.cpp
+++ b/core/fpdfapi/page/cpdf_allstates.cpp
@@ -39,7 +39,7 @@ void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, float phase, float scale) {
void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
CPDF_StreamContentParser* pParser) {
for (const auto& it : *pGS) {
- const CFX_ByteString& key_str = it.first;
+ const ByteString& key_str = it.first;
CPDF_Object* pElement = it.second.get();
CPDF_Object* pObject = pElement ? pElement->GetDirect() : nullptr;
if (!pObject)
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index aee7316bdf..c37b5a4177 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -198,7 +198,7 @@ class CPDF_IndexedCS : public CPDF_ColorSpace {
CFX_UnownedPtr<CPDF_CountedColorSpace> m_pCountedBaseCS;
int m_nBaseComponents;
int m_MaxIndex;
- CFX_ByteString m_Table;
+ ByteString m_Table;
float* m_pCompMinMax;
};
@@ -364,8 +364,7 @@ void XYZ_to_sRGB_WhitePoint(float X,
} // namespace
-CPDF_ColorSpace* CPDF_ColorSpace::ColorspaceFromName(
- const CFX_ByteString& name) {
+CPDF_ColorSpace* CPDF_ColorSpace::ColorspaceFromName(const ByteString& name) {
if (name == "DeviceRGB" || name == "RGB")
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB);
if (name == "DeviceGray" || name == "G")
@@ -422,7 +421,7 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load(
if (!pFamilyObj)
return nullptr;
- CFX_ByteString familyname = pFamilyObj->GetString();
+ ByteString familyname = pFamilyObj->GetString();
if (pArray->GetCount() == 1)
return std::unique_ptr<CPDF_ColorSpace>(ColorspaceFromName(familyname));
@@ -1029,7 +1028,7 @@ bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc,
} else if (CPDF_Stream* pStream = pTableObj->AsStream()) {
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
pAcc->LoadAllData(false);
- m_Table = CFX_ByteStringC(pAcc->GetData(), pAcc->GetSize());
+ m_Table = ByteStringView(pAcc->GetData(), pAcc->GetSize());
}
return true;
}
@@ -1080,7 +1079,7 @@ void CPDF_SeparationCS::GetDefaultValue(int iComponent,
bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc,
CPDF_Array* pArray,
std::set<CPDF_Object*>* pVisited) {
- CFX_ByteString name = pArray->GetStringAt(1);
+ ByteString name = pArray->GetStringAt(1);
if (name == "None") {
m_Type = None;
return true;
diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h
index 31dd32629b..d9f9a1dd44 100644
--- a/core/fpdfapi/page/cpdf_colorspace.h
+++ b/core/fpdfapi/page/cpdf_colorspace.h
@@ -42,7 +42,7 @@ struct PatternValue {
class CPDF_ColorSpace {
public:
static CPDF_ColorSpace* GetStockCS(int Family);
- static CPDF_ColorSpace* ColorspaceFromName(const CFX_ByteString& name);
+ static CPDF_ColorSpace* ColorspaceFromName(const ByteString& name);
static std::unique_ptr<CPDF_ColorSpace> Load(CPDF_Document* pDoc,
CPDF_Object* pCSObj);
static std::unique_ptr<CPDF_ColorSpace> Load(
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp
index 07f0bd931d..7d411b2084 100644
--- a/core/fpdfapi/page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/page/cpdf_contentmark.cpp
@@ -36,7 +36,7 @@ int CPDF_ContentMark::GetMCID() const {
return pData ? pData->GetMCID() : -1;
}
-void CPDF_ContentMark::AddMark(const CFX_ByteString& name,
+void CPDF_ContentMark::AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDirect) {
m_Ref.GetPrivateCopy()->AddMark(name, pDict, bDirect);
@@ -48,7 +48,7 @@ void CPDF_ContentMark::DeleteLastMark() {
m_Ref.SetNull();
}
-bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
+bool CPDF_ContentMark::HasMark(const ByteStringView& mark) const {
const MarkData* pData = m_Ref.GetObject();
if (!pData)
return false;
@@ -60,7 +60,7 @@ bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
return false;
}
-bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark,
+bool CPDF_ContentMark::LookupMark(const ByteStringView& mark,
CPDF_Dictionary*& pDict) const {
const MarkData* pData = m_Ref.GetObject();
if (!pData)
@@ -105,7 +105,7 @@ int CPDF_ContentMark::MarkData::GetMCID() const {
return -1;
}
-void CPDF_ContentMark::MarkData::AddMark(const CFX_ByteString& name,
+void CPDF_ContentMark::MarkData::AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDirect) {
CPDF_ContentMarkItem item;
diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h
index ab966c0728..1b2fe79e3c 100644
--- a/core/fpdfapi/page/cpdf_contentmark.h
+++ b/core/fpdfapi/page/cpdf_contentmark.h
@@ -27,11 +27,9 @@ class CPDF_ContentMark {
int CountItems() const;
const CPDF_ContentMarkItem& GetItem(int i) const;
- bool HasMark(const CFX_ByteStringC& mark) const;
- bool LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const;
- void AddMark(const CFX_ByteString& name,
- CPDF_Dictionary* pDict,
- bool bDirect);
+ bool HasMark(const ByteStringView& mark) const;
+ bool LookupMark(const ByteStringView& mark, CPDF_Dictionary*& pDict) const;
+ void AddMark(const ByteString& name, CPDF_Dictionary* pDict, bool bDirect);
void DeleteLastMark();
bool HasRef() const { return !!m_Ref; }
@@ -48,7 +46,7 @@ class CPDF_ContentMark {
const CPDF_ContentMarkItem& GetItem(int index) const;
int GetMCID() const;
- void AddMark(const CFX_ByteString& name,
+ void AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDictNeedClone);
void DeleteLastMark();
diff --git a/core/fpdfapi/page/cpdf_contentmarkitem.h b/core/fpdfapi/page/cpdf_contentmarkitem.h
index afd2833691..83c700fc52 100644
--- a/core/fpdfapi/page/cpdf_contentmarkitem.h
+++ b/core/fpdfapi/page/cpdf_contentmarkitem.h
@@ -26,17 +26,17 @@ class CPDF_ContentMarkItem {
CPDF_ContentMarkItem& operator=(CPDF_ContentMarkItem&& other) = default;
- CFX_ByteString GetName() const { return m_MarkName; }
+ ByteString GetName() const { return m_MarkName; }
ParamType GetParamType() const { return m_ParamType; }
CPDF_Dictionary* GetParam() const;
bool HasMCID() const;
- void SetName(const CFX_ByteString& name) { m_MarkName = name; }
+ void SetName(const ByteString& name) { m_MarkName = name; }
void SetDirectDict(std::unique_ptr<CPDF_Dictionary> pDict);
void SetPropertiesDict(CPDF_Dictionary* pDict);
private:
- CFX_ByteString m_MarkName;
+ ByteString m_MarkName;
ParamType m_ParamType;
CFX_UnownedPtr<CPDF_Dictionary> m_pPropertiesDict;
std::unique_ptr<CPDF_Dictionary> m_pDirectDict;
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 1af9d6ee22..08345dac78 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -144,7 +144,7 @@ CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict) {
return pFontData->AddRef();
}
-CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteString& fontName,
+CPDF_Font* CPDF_DocPageData::GetStandardFont(const ByteString& fontName,
CPDF_FontEncoding* pEncoding) {
if (fontName.IsEmpty())
return nullptr;
@@ -228,7 +228,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceGuarded(
pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pCSObj);
if (pCSObj->IsName()) {
- CFX_ByteString name = pCSObj->GetString();
+ ByteString name = pCSObj->GetString();
CPDF_ColorSpace* pCS = CPDF_ColorSpace::ColorspaceFromName(name);
if (!pCS && pResources) {
CPDF_Dictionary* pList = pResources->GetDictFor("ColorSpace");
@@ -422,7 +422,7 @@ CFX_RetainPtr<CPDF_IccProfile> CPDF_DocPageData::GetIccProfile(
uint8_t digest[20];
CRYPT_SHA1Generate(pAccessor->GetData(), pAccessor->GetSize(), digest);
- CFX_ByteString bsDigest(digest, 20);
+ ByteString bsDigest(digest, 20);
auto hash_it = m_HashProfileMap.find(bsDigest);
if (hash_it != m_HashProfileMap.end()) {
auto it_copied_stream = m_IccProfileMap.find(hash_it->second);
diff --git a/core/fpdfapi/page/cpdf_docpagedata.h b/core/fpdfapi/page/cpdf_docpagedata.h
index 40647bc9a6..3f1d392262 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.h
+++ b/core/fpdfapi/page/cpdf_docpagedata.h
@@ -35,7 +35,7 @@ class CPDF_DocPageData {
bool IsForceClear() const { return m_bForceClear; }
CPDF_Font* GetFont(CPDF_Dictionary* pFontDict);
- CPDF_Font* GetStandardFont(const CFX_ByteString& fontName,
+ CPDF_Font* GetStandardFont(const ByteString& fontName,
CPDF_FontEncoding* pEncoding);
void ReleaseFont(const CPDF_Dictionary* pFontDict);
@@ -70,7 +70,7 @@ class CPDF_DocPageData {
bool m_bForceClear;
CFX_UnownedPtr<CPDF_Document> const m_pPDFDoc;
- std::map<CFX_ByteString, CPDF_Stream*> m_HashProfileMap;
+ std::map<ByteString, CPDF_Stream*> m_HashProfileMap;
std::map<const CPDF_Object*, CPDF_CountedColorSpace*> m_ColorSpaceMap;
std::map<const CPDF_Stream*, CFX_RetainPtr<CPDF_StreamAcc>> m_FontFileMap;
std::map<const CPDF_Dictionary*, CPDF_CountedFont*> m_FontMap;
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp
index 540707447e..c5c259f051 100644
--- a/core/fpdfapi/page/cpdf_generalstate.cpp
+++ b/core/fpdfapi/page/cpdf_generalstate.cpp
@@ -13,7 +13,7 @@
namespace {
-int RI_StringToId(const CFX_ByteString& ri) {
+int RI_StringToId(const ByteString& ri) {
uint32_t id = ri.GetID();
if (id == FXBSTR_ID('A', 'b', 's', 'o'))
return 1;
@@ -27,7 +27,7 @@ int RI_StringToId(const CFX_ByteString& ri) {
return 0;
}
-int GetBlendTypeInternal(const CFX_ByteString& mode) {
+int GetBlendTypeInternal(const ByteString& mode) {
switch (mode.GetID()) {
case FXBSTR_ID('N', 'o', 'r', 'm'):
case FXBSTR_ID('C', 'o', 'm', 'p'):
@@ -75,45 +75,45 @@ CPDF_GeneralState::CPDF_GeneralState(const CPDF_GeneralState& that)
CPDF_GeneralState::~CPDF_GeneralState() {}
-void CPDF_GeneralState::SetRenderIntent(const CFX_ByteString& ri) {
+void CPDF_GeneralState::SetRenderIntent(const ByteString& ri) {
m_Ref.GetPrivateCopy()->m_RenderIntent = RI_StringToId(ri);
}
-CFX_ByteString CPDF_GeneralState::GetBlendMode() const {
+ByteString CPDF_GeneralState::GetBlendMode() const {
switch (GetBlendType()) {
case FXDIB_BLEND_NORMAL:
- return CFX_ByteString("Normal");
+ return ByteString("Normal");
case FXDIB_BLEND_MULTIPLY:
- return CFX_ByteString("Multiply");
+ return ByteString("Multiply");
case FXDIB_BLEND_SCREEN:
- return CFX_ByteString("Screen");
+ return ByteString("Screen");
case FXDIB_BLEND_OVERLAY:
- return CFX_ByteString("Overlay");
+ return ByteString("Overlay");
case FXDIB_BLEND_DARKEN:
- return CFX_ByteString("Darken");
+ return ByteString("Darken");
case FXDIB_BLEND_LIGHTEN:
- return CFX_ByteString("Lighten");
+ return ByteString("Lighten");
case FXDIB_BLEND_COLORDODGE:
- return CFX_ByteString("ColorDodge");
+ return ByteString("ColorDodge");
case FXDIB_BLEND_COLORBURN:
- return CFX_ByteString("ColorBurn");
+ return ByteString("ColorBurn");
case FXDIB_BLEND_HARDLIGHT:
- return CFX_ByteString("HardLight");
+ return ByteString("HardLight");
case FXDIB_BLEND_SOFTLIGHT:
- return CFX_ByteString("SoftLight");
+ return ByteString("SoftLight");
case FXDIB_BLEND_DIFFERENCE:
- return CFX_ByteString("Difference");
+ return ByteString("Difference");
case FXDIB_BLEND_EXCLUSION:
- return CFX_ByteString("Exclusion");
+ return ByteString("Exclusion");
case FXDIB_BLEND_HUE:
- return CFX_ByteString("Hue");
+ return ByteString("Hue");
case FXDIB_BLEND_SATURATION:
- return CFX_ByteString("Saturation");
+ return ByteString("Saturation");
case FXDIB_BLEND_COLOR:
- return CFX_ByteString("Color");
+ return ByteString("Color");
case FXDIB_BLEND_LUMINOSITY:
- return CFX_ByteString("Luminosity");
+ return ByteString("Luminosity");
}
- return CFX_ByteString("Normal");
+ return ByteString("Normal");
}
int CPDF_GeneralState::GetBlendType() const {
@@ -171,7 +171,7 @@ void CPDF_GeneralState::SetTransferFunc(
m_Ref.GetPrivateCopy()->m_pTransferFunc = pFunc;
}
-void CPDF_GeneralState::SetBlendMode(const CFX_ByteString& mode) {
+void CPDF_GeneralState::SetBlendMode(const ByteString& mode) {
StateData* pData = m_Ref.GetPrivateCopy();
pData->m_BlendMode = mode;
pData->m_BlendType = GetBlendTypeInternal(mode);
diff --git a/core/fpdfapi/page/cpdf_generalstate.h b/core/fpdfapi/page/cpdf_generalstate.h
index b5b48a94cd..95f59784f2 100644
--- a/core/fpdfapi/page/cpdf_generalstate.h
+++ b/core/fpdfapi/page/cpdf_generalstate.h
@@ -25,9 +25,9 @@ class CPDF_GeneralState {
void Emplace() { m_Ref.Emplace(); }
bool HasRef() const { return !!m_Ref; }
- void SetRenderIntent(const CFX_ByteString& ri);
+ void SetRenderIntent(const ByteString& ri);
- CFX_ByteString GetBlendMode() const;
+ ByteString GetBlendMode() const;
int GetBlendType() const;
void SetBlendType(int type);
@@ -46,7 +46,7 @@ class CPDF_GeneralState {
CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc() const;
void SetTransferFunc(const CFX_RetainPtr<CPDF_TransferFunc>& pFunc);
- void SetBlendMode(const CFX_ByteString& mode);
+ void SetBlendMode(const ByteString& mode);
const CFX_Matrix* GetSMaskMatrix() const;
void SetSMaskMatrix(const CFX_Matrix& matrix);
@@ -83,7 +83,7 @@ class CPDF_GeneralState {
StateData(const StateData& that);
~StateData();
- CFX_ByteString m_BlendMode;
+ ByteString m_BlendMode;
int m_BlendType;
CFX_UnownedPtr<CPDF_Object> m_pSoftMask;
CFX_Matrix m_SMaskMatrix;
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index a551bd1811..6e8c0e13c0 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -201,7 +201,7 @@ void CPDF_Image::SetImage(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
pCS->AddNew<CPDF_Name>("Indexed");
pCS->AddNew<CPDF_Name>("DeviceRGB");
pCS->AddNew<CPDF_Number>(1);
- CFX_ByteString ct;
+ ByteString ct;
char* pBuf = ct.GetBuffer(6);
pBuf[0] = (char)reset_r;
pBuf[1] = (char)reset_g;
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 6213e5fccb..148b30a51c 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -97,7 +97,7 @@ void CPDF_Page::SetRenderContext(
m_pRenderContext = std::move(pContext);
}
-CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteString& name) const {
+CPDF_Object* CPDF_Page::GetPageAttr(const ByteString& name) const {
CPDF_Dictionary* pPageDict = m_pFormDict.Get();
std::set<CPDF_Dictionary*> visited;
while (1) {
@@ -112,7 +112,7 @@ CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteString& name) const {
return nullptr;
}
-CFX_FloatRect CPDF_Page::GetBox(const CFX_ByteString& name) const {
+CFX_FloatRect CPDF_Page::GetBox(const ByteString& name) const {
CFX_FloatRect box;
CPDF_Array* pBox = ToArray(GetPageAttr(name));
if (pBox) {
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h
index 47fba3caec..e32a7f0fe8 100644
--- a/core/fpdfapi/page/cpdf_page.h
+++ b/core/fpdfapi/page/cpdf_page.h
@@ -62,8 +62,8 @@ class CPDF_Page : public CPDF_PageObjectHolder {
private:
void StartParse();
- CPDF_Object* GetPageAttr(const CFX_ByteString& name) const;
- CFX_FloatRect GetBox(const CFX_ByteString& name) const;
+ CPDF_Object* GetPageAttr(const ByteString& name) const;
+ CFX_FloatRect GetBox(const ByteString& name) const;
float m_PageWidth;
float m_PageHeight;
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h
index 9ac1a3bdba..c223d4b523 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.h
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.h
@@ -37,8 +37,8 @@ struct GraphicsData {
};
struct FontData {
- CFX_ByteString baseFont;
- CFX_ByteString type;
+ ByteString baseFont;
+ ByteString type;
bool operator<(const FontData& other) const;
};
@@ -76,8 +76,8 @@ class CPDF_PageObjectHolder {
CFX_UnownedPtr<CPDF_Document> m_pDocument;
CFX_UnownedPtr<CPDF_Dictionary> m_pPageResources;
CFX_UnownedPtr<CPDF_Dictionary> m_pResources;
- std::map<GraphicsData, CFX_ByteString> m_GraphicsMap;
- std::map<FontData, CFX_ByteString> m_FontsMap;
+ std::map<GraphicsData, ByteString> m_GraphicsMap;
+ std::map<FontData, ByteString> m_FontsMap;
CFX_FloatRect m_BBox;
int m_Transparency;
diff --git a/core/fpdfapi/page/cpdf_psengine.cpp b/core/fpdfapi/page/cpdf_psengine.cpp
index 658d73cda3..63560fccc0 100644
--- a/core/fpdfapi/page/cpdf_psengine.cpp
+++ b/core/fpdfapi/page/cpdf_psengine.cpp
@@ -133,7 +133,7 @@ float CPDF_PSEngine::Pop() {
bool CPDF_PSEngine::Parse(const char* str, int size) {
CPDF_SimpleParser parser(reinterpret_cast<const uint8_t*>(str), size);
- CFX_ByteStringC word = parser.GetWord();
+ ByteStringView word = parser.GetWord();
return word == "{" ? m_MainProc.Parse(&parser, 0) : false;
}
@@ -142,7 +142,7 @@ bool CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
return false;
while (1) {
- CFX_ByteStringC word = parser->GetWord();
+ ByteStringView word = parser->GetWord();
if (word.IsEmpty())
return false;
@@ -158,7 +158,7 @@ bool CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
std::unique_ptr<CPDF_PSOP> op;
for (const PDF_PSOpName& op_name : kPsOpNames) {
- if (word == CFX_ByteStringC(op_name.name)) {
+ if (word == ByteStringView(op_name.name)) {
op = pdfium::MakeUnique<CPDF_PSOP>(op_name.op);
break;
}
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 3755b2985a..c58e456238 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -156,18 +156,17 @@ const AbbrPair InlineValueAbbr[] = {
struct AbbrReplacementOp {
bool is_replace_key;
- CFX_ByteString key;
- CFX_ByteStringC replacement;
+ ByteString key;
+ ByteStringView replacement;
};
-CFX_ByteStringC FindFullName(const AbbrPair* table,
- size_t count,
- const CFX_ByteStringC& abbr) {
+ByteStringView FindFullName(const AbbrPair* table,
+ size_t count,
+ const ByteStringView& abbr) {
auto* it = std::find_if(table, table + count, [abbr](const AbbrPair& pair) {
return pair.abbr == abbr;
});
- return it != table + count ? CFX_ByteStringC(it->full_name)
- : CFX_ByteStringC();
+ return it != table + count ? ByteStringView(it->full_name) : ByteStringView();
}
void ReplaceAbbr(CPDF_Object* pObj) {
@@ -176,10 +175,10 @@ void ReplaceAbbr(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->AsDictionary();
std::vector<AbbrReplacementOp> replacements;
for (const auto& it : *pDict) {
- CFX_ByteString key = it.first;
+ ByteString key = it.first;
CPDF_Object* value = it.second.get();
- CFX_ByteStringC fullname = FindFullName(
- InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), key.AsStringC());
+ ByteStringView fullname = FindFullName(
+ InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), key.AsStringView());
if (!fullname.IsEmpty()) {
AbbrReplacementOp op;
op.is_replace_key = true;
@@ -190,9 +189,10 @@ void ReplaceAbbr(CPDF_Object* pObj) {
}
if (value->IsName()) {
- CFX_ByteString name = value->GetString();
- fullname = FindFullName(
- InlineValueAbbr, FX_ArraySize(InlineValueAbbr), name.AsStringC());
+ ByteString name = value->GetString();
+ fullname =
+ FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr),
+ name.AsStringView());
if (!fullname.IsEmpty()) {
AbbrReplacementOp op;
op.is_replace_key = false;
@@ -206,9 +206,9 @@ void ReplaceAbbr(CPDF_Object* pObj) {
}
for (const auto& op : replacements) {
if (op.is_replace_key)
- pDict->ReplaceKey(op.key, CFX_ByteString(op.replacement));
+ pDict->ReplaceKey(op.key, ByteString(op.replacement));
else
- pDict->SetNewFor<CPDF_Name>(op.key, CFX_ByteString(op.replacement));
+ pDict->SetNewFor<CPDF_Name>(op.key, ByteString(op.replacement));
}
break;
}
@@ -217,11 +217,12 @@ void ReplaceAbbr(CPDF_Object* pObj) {
for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetObjectAt(i);
if (pElement->IsName()) {
- CFX_ByteString name = pElement->GetString();
- CFX_ByteStringC fullname = FindFullName(
- InlineValueAbbr, FX_ArraySize(InlineValueAbbr), name.AsStringC());
+ ByteString name = pElement->GetString();
+ ByteStringView fullname =
+ FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr),
+ name.AsStringView());
if (!fullname.IsEmpty())
- pArray->SetNewAt<CPDF_Name>(i, CFX_ByteString(fullname));
+ pArray->SetNewAt<CPDF_Name>(i, ByteString(fullname));
} else {
ReplaceAbbr(pElement);
}
@@ -307,7 +308,7 @@ int CPDF_StreamContentParser::GetNextParamPos() {
return index;
}
-void CPDF_StreamContentParser::AddNameParam(const CFX_ByteStringC& bsName) {
+void CPDF_StreamContentParser::AddNameParam(const ByteStringView& bsName) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
if (bsName.GetLength() > 32) {
param.m_Type = ContentParam::OBJECT;
@@ -316,7 +317,7 @@ void CPDF_StreamContentParser::AddNameParam(const CFX_ByteStringC& bsName) {
} else {
param.m_Type = ContentParam::NAME;
if (bsName.Contains('#')) {
- CFX_ByteString str = PDF_NameDecode(bsName);
+ ByteString str = PDF_NameDecode(bsName);
memcpy(param.m_Name.m_Buffer, str.c_str(), str.GetLength());
param.m_Name.m_Len = str.GetLength();
} else {
@@ -326,7 +327,7 @@ void CPDF_StreamContentParser::AddNameParam(const CFX_ByteStringC& bsName) {
}
}
-void CPDF_StreamContentParser::AddNumberParam(const CFX_ByteStringC& str) {
+void CPDF_StreamContentParser::AddNumberParam(const ByteStringView& str) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
param.m_Type = ContentParam::NUMBER;
param.m_Number.m_bInteger = FX_atonum(str, &param.m_Number.m_Integer);
@@ -373,7 +374,7 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) {
param.m_Type = ContentParam::OBJECT;
param.m_pObject = pdfium::MakeUnique<CPDF_Name>(
m_pDocument->GetByteStringPool(),
- CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len));
+ ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len));
return param.m_pObject.get();
}
if (param.m_Type == ContentParam::OBJECT)
@@ -383,9 +384,9 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) {
return nullptr;
}
-CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
+ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
if (index >= m_ParamCount) {
- return CFX_ByteString();
+ return ByteString();
}
int real_index = m_ParamStartPos + m_ParamCount - index - 1;
if (real_index >= kParamBufSize) {
@@ -393,12 +394,12 @@ CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
}
ContentParam& param = m_ParamBuf[real_index];
if (param.m_Type == ContentParam::NAME) {
- return CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len);
+ return ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len);
}
if (param.m_Type == 0 && param.m_pObject) {
return param.m_pObject->GetString();
}
- return CFX_ByteString();
+ return ByteString();
}
float CPDF_StreamContentParser::GetNumber(uint32_t index) {
@@ -559,7 +560,7 @@ CPDF_StreamContentParser::InitializeOpCodes() {
});
}
-void CPDF_StreamContentParser::OnOperator(const CFX_ByteStringC& op) {
+void CPDF_StreamContentParser::OnOperator(const ByteStringView& op) {
static const OpCodes s_OpCodes = InitializeOpCodes();
auto it = s_OpCodes.find(op.GetID());
@@ -586,7 +587,7 @@ void CPDF_StreamContentParser::Handle_EOFillStrokePath() {
}
void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() {
- CFX_ByteString tag = GetString(1);
+ ByteString tag = GetString(1);
CPDF_Object* pProperty = GetObject(0);
if (!pProperty) {
return;
@@ -619,7 +620,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
break;
}
auto word = m_pSyntax->GetWord();
- CFX_ByteString key(word.Right(word.GetLength() - 1));
+ ByteString key(word.Right(word.GetLength() - 1));
auto pObj = m_pSyntax->ReadNextObject(false, false, 0);
if (!key.IsEmpty()) {
uint32_t dwObjNum = pObj ? pObj->GetObjNum() : 0;
@@ -634,7 +635,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
if (pDict->KeyExist("ColorSpace")) {
pCSObj = pDict->GetDirectObjectFor("ColorSpace");
if (pCSObj->IsName()) {
- CFX_ByteString name = pCSObj->GetString();
+ ByteString name = pCSObj->GetString();
if (name != "DeviceRGB" && name != "DeviceGray" && name != "DeviceCMYK") {
pCSObj = FindResourceObj("ColorSpace", name);
if (pCSObj && pCSObj->IsInline())
@@ -727,7 +728,7 @@ void CPDF_StreamContentParser::Handle_SetCachedDevice() {
}
void CPDF_StreamContentParser::Handle_ExecuteXObject() {
- CFX_ByteString name = GetString(0);
+ ByteString name = GetString(0);
if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() &&
m_pLastImage->GetStream()->GetObjNum()) {
CPDF_ImageObject* pObj = AddImage(m_pLastImage);
@@ -744,7 +745,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
return;
}
- CFX_ByteString type;
+ ByteString type;
if (pXObject->GetDict())
type = pXObject->GetDict()->GetStringFor("Subtype");
@@ -875,7 +876,7 @@ void CPDF_StreamContentParser::Handle_SetGray_Stroke() {
}
void CPDF_StreamContentParser::Handle_SetExtendGraphState() {
- CFX_ByteString name = GetString(0);
+ ByteString name = GetString(0);
CPDF_Dictionary* pGS = ToDictionary(FindResourceObj("ExtGState", name));
if (!pGS) {
m_bResourceMissing = true;
@@ -1155,9 +1156,8 @@ void CPDF_StreamContentParser::Handle_SetFont() {
}
}
-CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
- const CFX_ByteString& type,
- const CFX_ByteString& name) {
+CPDF_Object* CPDF_StreamContentParser::FindResourceObj(const ByteString& type,
+ const ByteString& name) {
if (!m_pResources)
return nullptr;
CPDF_Dictionary* pDict = m_pResources->GetDictFor(type);
@@ -1170,7 +1170,7 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
return pPageDict ? pPageDict->GetDirectObjectFor(name) : nullptr;
}
-CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
+CPDF_Font* CPDF_StreamContentParser::FindFont(const ByteString& name) {
CPDF_Dictionary* pFontDict = ToDictionary(FindResourceObj("Font", name));
if (!pFontDict) {
m_bResourceMissing = true;
@@ -1186,12 +1186,12 @@ CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
}
CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
- const CFX_ByteString& name) {
+ const ByteString& name) {
if (name == "Pattern") {
return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN);
}
if (name == "DeviceGray" || name == "DeviceCMYK" || name == "DeviceRGB") {
- CFX_ByteString defname = "Default";
+ ByteString defname = "Default";
defname += name.Right(name.GetLength() - 7);
CPDF_Object* pDefObj = FindResourceObj("ColorSpace", defname);
if (!pDefObj) {
@@ -1213,7 +1213,7 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
return m_pDocument->LoadColorSpace(pCSObj);
}
-CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
+CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const ByteString& name,
bool bShading) {
CPDF_Object* pPattern =
FindResourceObj(bShading ? "Shading" : "Pattern", name);
@@ -1225,7 +1225,7 @@ CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
m_pCurStates->m_ParentMatrix);
}
-void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
+void CPDF_StreamContentParser::AddTextObject(ByteString* pStrs,
float fInitKerning,
float* pKerning,
int nsegs) {
@@ -1290,7 +1290,7 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
}
void CPDF_StreamContentParser::Handle_ShowText() {
- CFX_ByteString str = GetString(0);
+ ByteString str = GetString(0);
if (str.IsEmpty()) {
return;
}
@@ -1317,14 +1317,14 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
}
return;
}
- std::vector<CFX_ByteString> strs(nsegs);
+ std::vector<ByteString> strs(nsegs);
std::vector<float> kernings(nsegs);
size_t iSegment = 0;
float fInitKerning = 0;
for (size_t i = 0; i < n; i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (pObj->IsString()) {
- CFX_ByteString str = pObj->GetString();
+ ByteString str = pObj->GetString();
if (str.IsEmpty())
continue;
strs[iSegment] = str;
@@ -1556,7 +1556,7 @@ void CPDF_StreamContentParser::ParsePathObject() {
case CPDF_StreamParser::EndOfData:
return;
case CPDF_StreamParser::Keyword: {
- CFX_ByteStringC strc = m_pSyntax->GetWord();
+ ByteStringView strc = m_pSyntax->GetWord();
int len = strc.GetLength();
if (len == 1) {
switch (strc[0]) {
@@ -1631,14 +1631,14 @@ void CPDF_StreamContentParser::ParsePathObject() {
}
// static
-CFX_ByteStringC CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- const CFX_ByteStringC& abbr) {
+ByteStringView CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
+ const ByteStringView& abbr) {
return FindFullName(InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), abbr);
}
// static
-CFX_ByteStringC CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- const CFX_ByteStringC& abbr) {
+ByteStringView CPDF_StreamContentParser::FindValueAbbreviationForTesting(
+ const ByteStringView& abbr) {
return FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr), abbr);
}
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h
index a027129c31..c30c6b7d3c 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.h
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.h
@@ -50,12 +50,12 @@ class CPDF_StreamContentParser {
CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); }
bool IsColored() const { return m_bColored; }
const float* GetType3Data() const { return m_Type3Data; }
- CPDF_Font* FindFont(const CFX_ByteString& name);
+ CPDF_Font* FindFont(const ByteString& name);
- static CFX_ByteStringC FindKeyAbbreviationForTesting(
- const CFX_ByteStringC& abbr);
- static CFX_ByteStringC FindValueAbbreviationForTesting(
- const CFX_ByteStringC& abbr);
+ static ByteStringView FindKeyAbbreviationForTesting(
+ const ByteStringView& abbr);
+ static ByteStringView FindValueAbbreviationForTesting(
+ const ByteStringView& abbr);
private:
struct ContentParam {
@@ -84,17 +84,17 @@ class CPDF_StreamContentParser {
using OpCodes = std::map<uint32_t, void (CPDF_StreamContentParser::*)()>;
static OpCodes InitializeOpCodes();
- void AddNameParam(const CFX_ByteStringC& str);
- void AddNumberParam(const CFX_ByteStringC& str);
+ void AddNameParam(const ByteStringView& str);
+ void AddNumberParam(const ByteStringView& str);
void AddObjectParam(std::unique_ptr<CPDF_Object> pObj);
int GetNextParamPos();
void ClearAllParams();
CPDF_Object* GetObject(uint32_t index);
- CFX_ByteString GetString(uint32_t index);
+ ByteString GetString(uint32_t index);
float GetNumber(uint32_t index);
int GetInteger(uint32_t index) { return (int32_t)(GetNumber(index)); }
- void OnOperator(const CFX_ByteStringC& op);
- void AddTextObject(CFX_ByteString* pText,
+ void OnOperator(const ByteStringView& op);
+ void AddTextObject(ByteString* pText,
float fInitKerning,
float* pKerning,
int count);
@@ -113,10 +113,9 @@ class CPDF_StreamContentParser {
bool bColor,
bool bText,
bool bGraph);
- CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name);
- CPDF_Pattern* FindPattern(const CFX_ByteString& name, bool bShading);
- CPDF_Object* FindResourceObj(const CFX_ByteString& type,
- const CFX_ByteString& name);
+ CPDF_ColorSpace* FindColorSpace(const ByteString& name);
+ CPDF_Pattern* FindPattern(const ByteString& name, bool bShading);
+ CPDF_Object* FindResourceObj(const ByteString& type, const ByteString& name);
// Takes ownership of |pImageObj|, returns unowned pointer to it.
CPDF_ImageObject* AddImageObject(std::unique_ptr<CPDF_ImageObject> pImageObj);
@@ -217,7 +216,7 @@ class CPDF_StreamContentParser {
float m_PathCurrentX;
float m_PathCurrentY;
uint8_t m_PathClipType;
- CFX_ByteString m_LastImageName;
+ ByteString m_LastImageName;
CFX_RetainPtr<CPDF_Image> m_pLastImage;
bool m_bColored;
float m_Type3Data[6];
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp b/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp
index 6b43935a1d..0f4fc1e87a 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp
@@ -6,39 +6,39 @@
#include "testing/gtest/include/gtest/gtest.h"
TEST(cpdf_streamcontentparser, PDF_FindKeyAbbreviation) {
- EXPECT_EQ(CFX_ByteStringC("BitsPerComponent"),
+ EXPECT_EQ(ByteStringView("BitsPerComponent"),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("BPC")));
- EXPECT_EQ(CFX_ByteStringC("Width"),
+ ByteStringView("BPC")));
+ EXPECT_EQ(ByteStringView("Width"),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("W")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("W")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("NoInList")));
+ ByteStringView("NoInList")));
// Prefix should not match.
- EXPECT_EQ(CFX_ByteStringC(""),
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("WW")));
+ ByteStringView("WW")));
}
TEST(cpdf_streamcontentparser, PDF_FindValueAbbreviation) {
- EXPECT_EQ(CFX_ByteStringC("DeviceGray"),
+ EXPECT_EQ(ByteStringView("DeviceGray"),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("G")));
- EXPECT_EQ(CFX_ByteStringC("DCTDecode"),
+ ByteStringView("G")));
+ EXPECT_EQ(ByteStringView("DCTDecode"),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("DCT")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("DCT")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("NoInList")));
+ ByteStringView("NoInList")));
// Prefix should not match.
- EXPECT_EQ(CFX_ByteStringC(""),
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("II")));
+ ByteStringView("II")));
}
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp
index f745331818..46cbfeb1fe 100644
--- a/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -64,7 +64,7 @@ uint32_t DecodeInlineStream(const uint8_t* src_buf,
uint32_t limit,
int width,
int height,
- const CFX_ByteString& decoder,
+ const ByteString& decoder,
CPDF_Dictionary* pParam,
uint8_t** dest_buf,
uint32_t* dest_size) {
@@ -104,10 +104,9 @@ uint32_t DecodeInlineStream(const uint8_t* src_buf,
CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize)
: m_pBuf(pData), m_Size(dwSize), m_Pos(0), m_pPool(nullptr) {}
-CPDF_StreamParser::CPDF_StreamParser(
- const uint8_t* pData,
- uint32_t dwSize,
- const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData,
+ uint32_t dwSize,
+ const CFX_WeakPtr<ByteStringPool>& pPool)
: m_pBuf(pData), m_Size(dwSize), m_Pos(0), m_pPool(pPool) {}
CPDF_StreamParser::~CPDF_StreamParser() {}
@@ -122,7 +121,7 @@ std::unique_ptr<CPDF_Stream> CPDF_StreamParser::ReadInlineStream(
if (PDFCharIsWhitespace(m_pBuf[m_Pos]))
m_Pos++;
- CFX_ByteString Decoder;
+ ByteString Decoder;
CPDF_Dictionary* pParam = nullptr;
CPDF_Object* pFilter = pDict->GetDirectObjectFor("Filter");
if (pFilter) {
@@ -312,18 +311,18 @@ std::unique_ptr<CPDF_Object> CPDF_StreamParser::ReadNextObject(
if (bIsNumber) {
m_WordBuffer[m_WordSize] = 0;
return pdfium::MakeUnique<CPDF_Number>(
- CFX_ByteStringC(m_WordBuffer, m_WordSize));
+ ByteStringView(m_WordBuffer, m_WordSize));
}
int first_char = m_WordBuffer[0];
if (first_char == '/') {
- CFX_ByteString name =
- PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1));
+ ByteString name =
+ PDF_NameDecode(ByteStringView(m_WordBuffer + 1, m_WordSize - 1));
return pdfium::MakeUnique<CPDF_Name>(m_pPool, name);
}
if (first_char == '(') {
- CFX_ByteString str = ReadString();
+ ByteString str = ReadString();
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false);
}
@@ -340,8 +339,8 @@ std::unique_ptr<CPDF_Object> CPDF_StreamParser::ReadNextObject(
if (!m_WordSize || m_WordBuffer[0] != '/')
return nullptr;
- CFX_ByteString key =
- PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1));
+ ByteString key =
+ PDF_NameDecode(ByteStringView(m_WordBuffer + 1, m_WordSize - 1));
std::unique_ptr<CPDF_Object> pObj =
ReadNextObject(true, bInArray, dwRecursionLevel + 1);
if (!pObj)
@@ -464,9 +463,9 @@ void CPDF_StreamParser::GetNextWord(bool& bIsNumber) {
}
}
-CFX_ByteString CPDF_StreamParser::ReadString() {
+ByteString CPDF_StreamParser::ReadString() {
if (!PositionIsInBounds())
- return CFX_ByteString();
+ return ByteString();
uint8_t ch = m_pBuf[m_Pos++];
std::ostringstream buf;
@@ -478,9 +477,9 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
case 0:
if (ch == ')') {
if (parlevel == 0) {
- return CFX_ByteString(buf.str().c_str(),
- std::min(static_cast<FX_STRSIZE>(buf.tellp()),
- kMaxStringLength));
+ return ByteString(buf.str().c_str(),
+ std::min(static_cast<FX_STRSIZE>(buf.tellp()),
+ kMaxStringLength));
}
parlevel--;
buf << ')';
@@ -555,14 +554,14 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
if (PositionIsInBounds())
++m_Pos;
- return CFX_ByteString(
+ return ByteString(
buf.str().c_str(),
std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength));
}
-CFX_ByteString CPDF_StreamParser::ReadHexString() {
+ByteString CPDF_StreamParser::ReadHexString() {
if (!PositionIsInBounds())
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
bool bFirst = true;
@@ -588,7 +587,7 @@ CFX_ByteString CPDF_StreamParser::ReadHexString() {
if (!bFirst)
buf << static_cast<char>(code);
- return CFX_ByteString(
+ return ByteString(
buf.str().c_str(),
std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength));
}
diff --git a/core/fpdfapi/page/cpdf_streamparser.h b/core/fpdfapi/page/cpdf_streamparser.h
index fdc418c634..32001a8b6e 100644
--- a/core/fpdfapi/page/cpdf_streamparser.h
+++ b/core/fpdfapi/page/cpdf_streamparser.h
@@ -24,12 +24,12 @@ class CPDF_StreamParser {
CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize);
CPDF_StreamParser(const uint8_t* pData,
uint32_t dwSize,
- const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_StreamParser();
SyntaxType ParseNextElement();
- CFX_ByteStringC GetWord() const {
- return CFX_ByteStringC(m_WordBuffer, m_WordSize);
+ ByteStringView GetWord() const {
+ return ByteStringView(m_WordBuffer, m_WordSize);
}
uint32_t GetPos() const { return m_Pos; }
void SetPos(uint32_t pos) { m_Pos = pos; }
@@ -46,8 +46,8 @@ class CPDF_StreamParser {
friend class cpdf_streamparser_ReadHexString_Test;
void GetNextWord(bool& bIsNumber);
- CFX_ByteString ReadString();
- CFX_ByteString ReadHexString();
+ ByteString ReadString();
+ ByteString ReadHexString();
bool PositionIsInBounds() const;
const uint8_t* m_pBuf;
@@ -56,7 +56,7 @@ class CPDF_StreamParser {
uint8_t m_WordBuffer[256];
uint32_t m_WordSize;
std::unique_ptr<CPDF_Object> m_pLastObj;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp
index a4d714ff72..4baf61dd72 100644
--- a/core/fpdfapi/page/cpdf_textobject.cpp
+++ b/core/fpdfapi/page/cpdf_textobject.cpp
@@ -136,7 +136,7 @@ CFX_Matrix CPDF_TextObject::GetTextMatrix() const {
pTextMatrix[3], m_Pos.x, m_Pos.y);
}
-void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
+void CPDF_TextObject::SetSegments(const ByteString* pStrs,
const float* pKerning,
int nsegs) {
m_CharCodes.clear();
@@ -162,7 +162,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
}
}
-void CPDF_TextObject::SetText(const CFX_ByteString& str) {
+void CPDF_TextObject::SetText(const ByteString& str) {
SetSegments(&str, nullptr, 1);
RecalcPositionData();
SetDirty(true);
diff --git a/core/fpdfapi/page/cpdf_textobject.h b/core/fpdfapi/page/cpdf_textobject.h
index e08b7280de..5cffbd1434 100644
--- a/core/fpdfapi/page/cpdf_textobject.h
+++ b/core/fpdfapi/page/cpdf_textobject.h
@@ -47,7 +47,7 @@ class CPDF_TextObject : public CPDF_PageObject {
CPDF_Font* GetFont() const;
float GetFontSize() const;
- void SetText(const CFX_ByteString& text);
+ void SetText(const ByteString& text);
void SetPosition(float x, float y);
void RecalcPositionData();
@@ -58,9 +58,7 @@ class CPDF_TextObject : public CPDF_PageObject {
friend class CPDF_TextRenderer;
friend class CPDF_PageContentGenerator;
- void SetSegments(const CFX_ByteString* pStrs,
- const float* pKerning,
- int nSegs);
+ void SetSegments(const ByteString* pStrs, const float* pKerning, int nSegs);
CFX_PointF CalcPositionData(float horz_scale);
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 41827db0d9..1f84f56547 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -52,7 +52,7 @@ void CFDF_Document::ParseStream(
parser.InitParser(m_pFile, 0);
while (1) {
bool bNumber;
- CFX_ByteString word = parser.GetNextWord(&bNumber);
+ ByteString word = parser.GetNextWord(&bNumber);
if (bNumber) {
uint32_t objnum = FXSYS_atoui(word.c_str());
if (!objnum)
@@ -89,9 +89,9 @@ void CFDF_Document::ParseStream(
}
}
-CFX_ByteString CFDF_Document::WriteToString() const {
+ByteString CFDF_Document::WriteToString() const {
if (!m_pRootDict)
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
buf << "%FDF-1.2\r\n";
@@ -102,5 +102,5 @@ CFX_ByteString CFDF_Document::WriteToString() const {
buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum()
<< " 0 R>>\r\n%%EOF\r\n";
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h
index d58f93ced4..a24415b099 100644
--- a/core/fpdfapi/parser/cfdf_document.h
+++ b/core/fpdfapi/parser/cfdf_document.h
@@ -27,7 +27,7 @@ class CFDF_Document : public CPDF_IndirectObjectHolder {
CFDF_Document();
~CFDF_Document() override;
- CFX_ByteString WriteToString() const;
+ ByteString WriteToString() const;
CPDF_Dictionary* GetRoot() const { return m_pRootDict.Get(); }
protected:
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index a0957b6c2b..f4907ffdf1 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -20,7 +20,7 @@
CPDF_Array::CPDF_Array() {}
-CPDF_Array::CPDF_Array(const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_Array::CPDF_Array(const CFX_WeakPtr<ByteStringPool>& pPool)
: m_pPool(pPool) {}
CPDF_Array::~CPDF_Array() {
@@ -100,15 +100,15 @@ CPDF_Object* CPDF_Array::GetDirectObjectAt(size_t i) const {
return m_Objects[i]->GetDirect();
}
-CFX_ByteString CPDF_Array::GetStringAt(size_t i) const {
+ByteString CPDF_Array::GetStringAt(size_t i) const {
if (i >= m_Objects.size())
- return CFX_ByteString();
+ return ByteString();
return m_Objects[i]->GetString();
}
-CFX_WideString CPDF_Array::GetUnicodeTextAt(size_t i) const {
+WideString CPDF_Array::GetUnicodeTextAt(size_t i) const {
if (i >= m_Objects.size())
- return CFX_WideString();
+ return WideString();
return m_Objects[i]->GetUnicodeText();
}
diff --git a/core/fpdfapi/parser/cpdf_array.h b/core/fpdfapi/parser/cpdf_array.h
index d1be233652..3b18025b2d 100644
--- a/core/fpdfapi/parser/cpdf_array.h
+++ b/core/fpdfapi/parser/cpdf_array.h
@@ -24,7 +24,7 @@ class CPDF_Array : public CPDF_Object {
std::vector<std::unique_ptr<CPDF_Object>>::const_iterator;
CPDF_Array();
- explicit CPDF_Array(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ explicit CPDF_Array(const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_Array() override;
// CPDF_Object:
@@ -39,8 +39,8 @@ class CPDF_Array : public CPDF_Object {
size_t GetCount() const { return m_Objects.size(); }
CPDF_Object* GetObjectAt(size_t index) const;
CPDF_Object* GetDirectObjectAt(size_t index) const;
- CFX_ByteString GetStringAt(size_t index) const;
- CFX_WideString GetUnicodeTextAt(size_t index) const;
+ ByteString GetStringAt(size_t index) const;
+ WideString GetUnicodeTextAt(size_t index) const;
int GetIntegerAt(size_t index) const;
float GetNumberAt(size_t index) const;
CPDF_Dictionary* GetDictAt(size_t index) const;
@@ -112,7 +112,7 @@ class CPDF_Array : public CPDF_Object {
std::set<const CPDF_Object*>* pVisited) const override;
std::vector<std::unique_ptr<CPDF_Object>> m_Objects;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
};
inline CPDF_Array* ToArray(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_boolean.cpp b/core/fpdfapi/parser/cpdf_boolean.cpp
index 2633c876d3..a1dc450519 100644
--- a/core/fpdfapi/parser/cpdf_boolean.cpp
+++ b/core/fpdfapi/parser/cpdf_boolean.cpp
@@ -22,7 +22,7 @@ std::unique_ptr<CPDF_Object> CPDF_Boolean::Clone() const {
return pdfium::MakeUnique<CPDF_Boolean>(m_bValue);
}
-CFX_ByteString CPDF_Boolean::GetString() const {
+ByteString CPDF_Boolean::GetString() const {
return m_bValue ? "true" : "false";
}
@@ -30,7 +30,7 @@ int CPDF_Boolean::GetInteger() const {
return m_bValue;
}
-void CPDF_Boolean::SetString(const CFX_ByteString& str) {
+void CPDF_Boolean::SetString(const ByteString& str) {
m_bValue = (str == "true");
}
@@ -48,5 +48,5 @@ const CPDF_Boolean* CPDF_Boolean::AsBoolean() const {
bool CPDF_Boolean::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString(" ") &&
- archive->WriteString(GetString().AsStringC());
+ archive->WriteString(GetString().AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_boolean.h b/core/fpdfapi/parser/cpdf_boolean.h
index 2dd1486b6a..c0a69d8932 100644
--- a/core/fpdfapi/parser/cpdf_boolean.h
+++ b/core/fpdfapi/parser/cpdf_boolean.h
@@ -22,9 +22,9 @@ class CPDF_Boolean : public CPDF_Object {
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
+ ByteString GetString() const override;
int GetInteger() const override;
- void SetString(const CFX_ByteString& str) override;
+ void SetString(const ByteString& str) override;
bool IsBoolean() const override;
CPDF_Boolean* AsBoolean() override;
const CPDF_Boolean* AsBoolean() const override;
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 74428ba6a8..cae95f2c19 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -230,14 +230,14 @@ bool CPDF_CryptoHandler::CryptFinish(void* context,
return true;
}
-CFX_ByteString CPDF_CryptoHandler::Decrypt(uint32_t objnum,
- uint32_t gennum,
- const CFX_ByteString& str) {
+ByteString CPDF_CryptoHandler::Decrypt(uint32_t objnum,
+ uint32_t gennum,
+ const ByteString& str) {
CFX_BinaryBuf dest_buf;
void* context = DecryptStart(objnum, gennum);
DecryptStream(context, str.raw_str(), str.GetLength(), dest_buf);
DecryptFinish(context, dest_buf);
- return CFX_ByteString(dest_buf.GetBuffer(), dest_buf.GetSize());
+ return ByteString(dest_buf.GetBuffer(), dest_buf.GetSize());
}
void* CPDF_CryptoHandler::DecryptStart(uint32_t objnum, uint32_t gennum) {
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.h b/core/fpdfapi/parser/cpdf_crypto_handler.h
index adf0c6c680..252f41c333 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.h
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.h
@@ -28,9 +28,7 @@ class CPDF_CryptoHandler : public CFX_Retainable {
CPDF_SecurityHandler* pSecurityHandler);
uint32_t DecryptGetSize(uint32_t src_size);
void* DecryptStart(uint32_t objnum, uint32_t gennum);
- CFX_ByteString Decrypt(uint32_t objnum,
- uint32_t gennum,
- const CFX_ByteString& str);
+ ByteString Decrypt(uint32_t objnum, uint32_t gennum, const ByteString& str);
bool DecryptStream(void* context,
const uint8_t* src_buf,
uint32_t src_size,
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index b10029d4ce..994d082712 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -473,7 +473,7 @@ bool CPDF_DataAvail::CheckPage() {
if (!pObj->IsDictionary())
continue;
- CFX_ByteString type = pObj->GetDict()->GetStringFor("Type");
+ ByteString type = pObj->GetDict()->GetStringFor("Type");
if (type == "Pages") {
m_PagesArray.push_back(std::move(pObj));
continue;
@@ -661,7 +661,7 @@ std::unique_ptr<CPDF_Object> CPDF_DataAvail::ParseIndirectObjectAt(
m_syntaxParser.SetPos(pos);
bool bIsNumber;
- CFX_ByteString word = m_syntaxParser.GetNextWord(&bIsNumber);
+ ByteString word = m_syntaxParser.GetNextWord(&bIsNumber);
if (!bIsNumber)
return nullptr;
@@ -723,7 +723,7 @@ bool CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
m_syntaxParser.SetPos(m_syntaxParser.m_HeaderOffset + 9);
bool bNumber;
- CFX_ByteString wordObjNum = m_syntaxParser.GetNextWord(&bNumber);
+ ByteString wordObjNum = m_syntaxParser.GetNextWord(&bNumber);
if (!bNumber)
return false;
@@ -761,7 +761,7 @@ bool CPDF_DataAvail::CheckEnd() {
m_syntaxParser.GetNextWord(nullptr);
bool bNumber;
- CFX_ByteString xrefpos_str = m_syntaxParser.GetNextWord(&bNumber);
+ ByteString xrefpos_str = m_syntaxParser.GetNextWord(&bNumber);
if (!bNumber) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
@@ -781,7 +781,7 @@ void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) {
m_Pos = dwOffset;
}
-bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
+bool CPDF_DataAvail::GetNextToken(ByteString* token) {
uint8_t ch;
if (!GetNextChar(ch))
return false;
@@ -814,7 +814,7 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
if (!PDFCharIsOther(ch) && !PDFCharIsNumeric(ch)) {
m_Pos--;
- *token = CFX_ByteString(buffer, index);
+ *token = ByteString(buffer, index);
return true;
}
if (index < sizeof(buffer))
@@ -837,7 +837,7 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
else
m_Pos--;
}
- *token = CFX_ByteString(buffer, index);
+ *token = ByteString(buffer, index);
return true;
}
@@ -854,7 +854,7 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
}
}
- *token = CFX_ByteString(buffer, index);
+ *token = ByteString(buffer, index);
return true;
}
@@ -885,7 +885,7 @@ bool CPDF_DataAvail::GetNextChar(uint8_t& ch) {
}
bool CPDF_DataAvail::CheckCrossRefItem() {
- CFX_ByteString token;
+ ByteString token;
while (1) {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
if (!GetNextToken(&token)) {
@@ -904,7 +904,7 @@ bool CPDF_DataAvail::CheckCrossRefItem() {
bool CPDF_DataAvail::CheckCrossRef() {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
- CFX_ByteString token;
+ ByteString token;
if (!GetNextToken(&token)) {
if (!GetValidator()->has_read_problems())
m_docStatus = PDF_DATAAVAIL_ERROR;
@@ -1046,7 +1046,7 @@ bool CPDF_DataAvail::CheckUnknownPageNode(uint32_t dwPageNo,
pPageNode->m_dwPageNo = dwPageNo;
CPDF_Dictionary* pDict = pPage->GetDict();
- const CFX_ByteString type = pDict->GetStringFor("Type");
+ const ByteString type = pDict->GetStringFor("Type");
if (type == "Page") {
pPageNode->m_type = PDF_PAGENODE_PAGE;
return true;
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index e2a4a20aa1..850ceeaae2 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -145,7 +145,7 @@ class CPDF_DataAvail final {
bool IsLinearizedFile(uint8_t* pData, uint32_t dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
- bool GetNextToken(CFX_ByteString* token);
+ bool GetNextToken(ByteString* token);
bool GetNextChar(uint8_t& ch);
std::unique_ptr<CPDF_Object> ParseIndirectObjectAt(
FX_FILESIZE pos,
@@ -200,7 +200,7 @@ class CPDF_DataAvail final {
FX_FILESIZE m_Pos;
FX_FILESIZE m_bufferOffset;
uint32_t m_bufferSize;
- CFX_ByteString m_WordBuf;
+ ByteString m_WordBuf;
uint8_t m_bufferData[512];
std::vector<uint32_t> m_XRefStreamList;
std::vector<uint32_t> m_PageObjList;
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index 4c035871df..570c57e557 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -22,9 +22,9 @@
#include "third_party/base/stl_util.h"
CPDF_Dictionary::CPDF_Dictionary()
- : CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>()) {}
+ : CPDF_Dictionary(CFX_WeakPtr<ByteStringPool>()) {}
-CPDF_Dictionary::CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_Dictionary::CPDF_Dictionary(const CFX_WeakPtr<ByteStringPool>& pPool)
: m_pPool(pPool) {}
CPDF_Dictionary::~CPDF_Dictionary() {
@@ -78,58 +78,56 @@ std::unique_ptr<CPDF_Object> CPDF_Dictionary::CloneNonCyclic(
return std::move(pCopy);
}
-CPDF_Object* CPDF_Dictionary::GetObjectFor(const CFX_ByteString& key) const {
+CPDF_Object* CPDF_Dictionary::GetObjectFor(const ByteString& key) const {
auto it = m_Map.find(key);
return it != m_Map.end() ? it->second.get() : nullptr;
}
-CPDF_Object* CPDF_Dictionary::GetDirectObjectFor(
- const CFX_ByteString& key) const {
+CPDF_Object* CPDF_Dictionary::GetDirectObjectFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetDirect() : nullptr;
}
-CFX_ByteString CPDF_Dictionary::GetStringFor(const CFX_ByteString& key) const {
+ByteString CPDF_Dictionary::GetStringFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
- return p ? p->GetString() : CFX_ByteString();
+ return p ? p->GetString() : ByteString();
}
-CFX_WideString CPDF_Dictionary::GetUnicodeTextFor(
- const CFX_ByteString& key) const {
+WideString CPDF_Dictionary::GetUnicodeTextFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
if (CPDF_Reference* pRef = ToReference(p))
p = pRef->GetDirect();
- return p ? p->GetUnicodeText() : CFX_WideString();
+ return p ? p->GetUnicodeText() : WideString();
}
-CFX_ByteString CPDF_Dictionary::GetStringFor(const CFX_ByteString& key,
- const CFX_ByteString& def) const {
+ByteString CPDF_Dictionary::GetStringFor(const ByteString& key,
+ const ByteString& def) const {
CPDF_Object* p = GetObjectFor(key);
- return p ? p->GetString() : CFX_ByteString(def);
+ return p ? p->GetString() : ByteString(def);
}
-int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key) const {
+int CPDF_Dictionary::GetIntegerFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetInteger() : 0;
}
-int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key, int def) const {
+int CPDF_Dictionary::GetIntegerFor(const ByteString& key, int def) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetInteger() : def;
}
-float CPDF_Dictionary::GetNumberFor(const CFX_ByteString& key) const {
+float CPDF_Dictionary::GetNumberFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetNumber() : 0;
}
-bool CPDF_Dictionary::GetBooleanFor(const CFX_ByteString& key,
+bool CPDF_Dictionary::GetBooleanFor(const ByteString& key,
bool bDefault) const {
CPDF_Object* p = GetObjectFor(key);
return ToBoolean(p) ? p->GetInteger() != 0 : bDefault;
}
-CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const CFX_ByteString& key) const {
+CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const ByteString& key) const {
CPDF_Object* p = GetDirectObjectFor(key);
if (!p)
return nullptr;
@@ -140,15 +138,15 @@ CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const CFX_ByteString& key) const {
return nullptr;
}
-CPDF_Array* CPDF_Dictionary::GetArrayFor(const CFX_ByteString& key) const {
+CPDF_Array* CPDF_Dictionary::GetArrayFor(const ByteString& key) const {
return ToArray(GetDirectObjectFor(key));
}
-CPDF_Stream* CPDF_Dictionary::GetStreamFor(const CFX_ByteString& key) const {
+CPDF_Stream* CPDF_Dictionary::GetStreamFor(const ByteString& key) const {
return ToStream(GetDirectObjectFor(key));
}
-CFX_FloatRect CPDF_Dictionary::GetRectFor(const CFX_ByteString& key) const {
+CFX_FloatRect CPDF_Dictionary::GetRectFor(const ByteString& key) const {
CFX_FloatRect rect;
CPDF_Array* pArray = GetArrayFor(key);
if (pArray)
@@ -156,7 +154,7 @@ CFX_FloatRect CPDF_Dictionary::GetRectFor(const CFX_ByteString& key) const {
return rect;
}
-CFX_Matrix CPDF_Dictionary::GetMatrixFor(const CFX_ByteString& key) const {
+CFX_Matrix CPDF_Dictionary::GetMatrixFor(const ByteString& key) const {
CFX_Matrix matrix;
CPDF_Array* pArray = GetArrayFor(key);
if (pArray)
@@ -164,7 +162,7 @@ CFX_Matrix CPDF_Dictionary::GetMatrixFor(const CFX_ByteString& key) const {
return matrix;
}
-bool CPDF_Dictionary::KeyExist(const CFX_ByteString& key) const {
+bool CPDF_Dictionary::KeyExist(const ByteString& key) const {
return pdfium::ContainsKey(m_Map, key);
}
@@ -175,7 +173,7 @@ bool CPDF_Dictionary::IsSignatureDict() const {
return pType && pType->GetString() == "Sig";
}
-CPDF_Object* CPDF_Dictionary::SetFor(const CFX_ByteString& key,
+CPDF_Object* CPDF_Dictionary::SetFor(const ByteString& key,
std::unique_ptr<CPDF_Object> pObj) {
if (!pObj) {
m_Map.erase(key);
@@ -188,7 +186,7 @@ CPDF_Object* CPDF_Dictionary::SetFor(const CFX_ByteString& key,
}
void CPDF_Dictionary::ConvertToIndirectObjectFor(
- const CFX_ByteString& key,
+ const ByteString& key,
CPDF_IndirectObjectHolder* pHolder) {
auto it = m_Map.find(key);
if (it == m_Map.end() || it->second->IsReference())
@@ -198,8 +196,7 @@ void CPDF_Dictionary::ConvertToIndirectObjectFor(
it->second = pdfium::MakeUnique<CPDF_Reference>(pHolder, pObj->GetObjNum());
}
-std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(
- const CFX_ByteString& key) {
+std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(const ByteString& key) {
std::unique_ptr<CPDF_Object> result;
auto it = m_Map.find(key);
if (it != m_Map.end()) {
@@ -209,8 +206,8 @@ std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(
return result;
}
-void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey,
- const CFX_ByteString& newkey) {
+void CPDF_Dictionary::ReplaceKey(const ByteString& oldkey,
+ const ByteString& newkey) {
auto old_it = m_Map.find(oldkey);
if (old_it == m_Map.end())
return;
@@ -223,7 +220,7 @@ void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey,
m_Map.erase(old_it);
}
-void CPDF_Dictionary::SetRectFor(const CFX_ByteString& key,
+void CPDF_Dictionary::SetRectFor(const ByteString& key,
const CFX_FloatRect& rect) {
CPDF_Array* pArray = SetNewFor<CPDF_Array>(key);
pArray->AddNew<CPDF_Number>(rect.left);
@@ -232,7 +229,7 @@ void CPDF_Dictionary::SetRectFor(const CFX_ByteString& key,
pArray->AddNew<CPDF_Number>(rect.top);
}
-void CPDF_Dictionary::SetMatrixFor(const CFX_ByteString& key,
+void CPDF_Dictionary::SetMatrixFor(const ByteString& key,
const CFX_Matrix& matrix) {
CPDF_Array* pArray = SetNewFor<CPDF_Array>(key);
pArray->AddNew<CPDF_Number>(matrix.a);
@@ -243,7 +240,7 @@ void CPDF_Dictionary::SetMatrixFor(const CFX_ByteString& key,
pArray->AddNew<CPDF_Number>(matrix.f);
}
-CFX_ByteString CPDF_Dictionary::MaybeIntern(const CFX_ByteString& str) {
+ByteString CPDF_Dictionary::MaybeIntern(const ByteString& str) {
return m_pPool ? m_pPool->Intern(str) : str;
}
@@ -252,10 +249,10 @@ bool CPDF_Dictionary::WriteTo(IFX_ArchiveStream* archive) const {
return false;
for (const auto& it : *this) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
if (!archive->WriteString("/") ||
- !archive->WriteString(PDF_NameEncode(key).AsStringC())) {
+ !archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return false;
}
diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h
index 31a09d954d..93c00c8c10 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.h
+++ b/core/fpdfapi/parser/cpdf_dictionary.h
@@ -24,10 +24,10 @@ class CPDF_IndirectObjectHolder;
class CPDF_Dictionary : public CPDF_Object {
public:
using const_iterator =
- std::map<CFX_ByteString, std::unique_ptr<CPDF_Object>>::const_iterator;
+ std::map<ByteString, std::unique_ptr<CPDF_Object>>::const_iterator;
CPDF_Dictionary();
- explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ explicit CPDF_Dictionary(const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_Dictionary() override;
// CPDF_Object:
@@ -40,76 +40,73 @@ class CPDF_Dictionary : public CPDF_Object {
bool WriteTo(IFX_ArchiveStream* archive) const override;
size_t GetCount() const { return m_Map.size(); }
- CPDF_Object* GetObjectFor(const CFX_ByteString& key) const;
- CPDF_Object* GetDirectObjectFor(const CFX_ByteString& key) const;
- CFX_ByteString GetStringFor(const CFX_ByteString& key) const;
- CFX_ByteString GetStringFor(const CFX_ByteString& key,
- const CFX_ByteString& default_str) const;
- CFX_WideString GetUnicodeTextFor(const CFX_ByteString& key) const;
- int GetIntegerFor(const CFX_ByteString& key) const;
- int GetIntegerFor(const CFX_ByteString& key, int default_int) const;
- bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const;
- float GetNumberFor(const CFX_ByteString& key) const;
- CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const;
- CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const;
- CPDF_Array* GetArrayFor(const CFX_ByteString& key) const;
- CFX_FloatRect GetRectFor(const CFX_ByteString& key) const;
- CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const;
- float GetFloatFor(const CFX_ByteString& key) const {
- return GetNumberFor(key);
- }
-
- bool KeyExist(const CFX_ByteString& key) const;
+ CPDF_Object* GetObjectFor(const ByteString& key) const;
+ CPDF_Object* GetDirectObjectFor(const ByteString& key) const;
+ ByteString GetStringFor(const ByteString& key) const;
+ ByteString GetStringFor(const ByteString& key,
+ const ByteString& default_str) const;
+ WideString GetUnicodeTextFor(const ByteString& key) const;
+ int GetIntegerFor(const ByteString& key) const;
+ int GetIntegerFor(const ByteString& key, int default_int) const;
+ bool GetBooleanFor(const ByteString& key, bool bDefault = false) const;
+ float GetNumberFor(const ByteString& key) const;
+ CPDF_Dictionary* GetDictFor(const ByteString& key) const;
+ CPDF_Stream* GetStreamFor(const ByteString& key) const;
+ CPDF_Array* GetArrayFor(const ByteString& key) const;
+ CFX_FloatRect GetRectFor(const ByteString& key) const;
+ CFX_Matrix GetMatrixFor(const ByteString& key) const;
+ float GetFloatFor(const ByteString& key) const { return GetNumberFor(key); }
+
+ bool KeyExist(const ByteString& key) const;
bool IsSignatureDict() const;
// Set* functions invalidate iterators for the element with the key |key|.
// Takes ownership of |pObj|, returns an unowned pointer to it.
- CPDF_Object* SetFor(const CFX_ByteString& key,
- std::unique_ptr<CPDF_Object> pObj);
+ CPDF_Object* SetFor(const ByteString& key, std::unique_ptr<CPDF_Object> pObj);
// Creates a new object owned by the dictionary and returns an unowned
// pointer to it.
template <typename T, typename... Args>
typename std::enable_if<!CanInternStrings<T>::value, T*>::type SetNewFor(
- const CFX_ByteString& key,
+ const ByteString& key,
Args&&... args) {
return static_cast<T*>(
SetFor(key, pdfium::MakeUnique<T>(std::forward<Args>(args)...)));
}
template <typename T, typename... Args>
typename std::enable_if<CanInternStrings<T>::value, T*>::type SetNewFor(
- const CFX_ByteString& key,
+ const ByteString& key,
Args&&... args) {
return static_cast<T*>(SetFor(
key, pdfium::MakeUnique<T>(m_pPool, std::forward<Args>(args)...)));
}
// Convenience functions to convert native objects to array form.
- void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect);
- void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix);
+ void SetRectFor(const ByteString& key, const CFX_FloatRect& rect);
+ void SetMatrixFor(const ByteString& key, const CFX_Matrix& matrix);
- void ConvertToIndirectObjectFor(const CFX_ByteString& key,
+ void ConvertToIndirectObjectFor(const ByteString& key,
CPDF_IndirectObjectHolder* pHolder);
// Invalidates iterators for the element with the key |key|.
- std::unique_ptr<CPDF_Object> RemoveFor(const CFX_ByteString& key);
+ std::unique_ptr<CPDF_Object> RemoveFor(const ByteString& key);
// Invalidates iterators for the element with the key |oldkey|.
- void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey);
+ void ReplaceKey(const ByteString& oldkey, const ByteString& newkey);
const_iterator begin() const { return m_Map.begin(); }
const_iterator end() const { return m_Map.end(); }
- CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const { return m_pPool; }
+ CFX_WeakPtr<ByteStringPool> GetByteStringPool() const { return m_pPool; }
protected:
- CFX_ByteString MaybeIntern(const CFX_ByteString& str);
+ ByteString MaybeIntern(const ByteString& str);
std::unique_ptr<CPDF_Object> CloneNonCyclic(
bool bDirect,
std::set<const CPDF_Object*>* visited) const override;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
- std::map<CFX_ByteString, std::unique_ptr<CPDF_Object>> m_Map;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
+ std::map<ByteString, std::unique_ptr<CPDF_Object>> m_Map;
};
inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 47155176ae..f47551f82b 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -217,8 +217,8 @@ void InsertWidthArray(HDC hDC, int start, int end, CPDF_Array* pWidthArray) {
InsertWidthArrayImpl(widths, size, pWidthArray);
}
-CFX_ByteString FPDF_GetPSNameFromTT(HDC hDC) {
- CFX_ByteString result;
+ByteString FPDF_GetPSNameFromTT(HDC hDC) {
+ ByteString result;
DWORD size = ::GetFontData(hDC, 'eman', 0, nullptr, 0);
if (size != GDI_ERROR) {
LPBYTE buffer = FX_Alloc(BYTE, size);
@@ -299,7 +299,7 @@ int CalculateFlags(bool bold,
void ProcessNonbCJK(CPDF_Dictionary* pBaseDict,
bool bold,
bool italic,
- CFX_ByteString basefont,
+ ByteString basefont,
std::unique_ptr<CPDF_Array> pWidths) {
if (bold && italic)
basefont += ",BoldItalic";
@@ -316,7 +316,7 @@ void ProcessNonbCJK(CPDF_Dictionary* pBaseDict,
std::unique_ptr<CPDF_Dictionary> CalculateFontDesc(
CPDF_Document* pDoc,
- CFX_ByteString basefont,
+ ByteString basefont,
int flags,
int italicangle,
int ascend,
@@ -769,7 +769,7 @@ void CPDF_Document::DeletePage(int iPage) {
CPDF_Font* CPDF_Document::AddStandardFont(const char* font,
CPDF_FontEncoding* pEncoding) {
- CFX_ByteString name(font);
+ ByteString name(font);
if (PDF_GetStandardFontName(&name) < 0)
return nullptr;
return GetPageData()->GetStandardFont(name, pEncoding);
@@ -793,7 +793,7 @@ size_t CPDF_Document::CalculateEncodingDict(int charset,
const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes;
for (int j = 0; j < 128; j++) {
- CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
+ ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
pArray->AddNew<CPDF_Name>(name.IsEmpty() ? ".notdef" : name);
}
pBaseDict->SetNewFor<CPDF_Reference>("Encoding", this,
@@ -805,11 +805,11 @@ CPDF_Dictionary* CPDF_Document::ProcessbCJK(
CPDF_Dictionary* pBaseDict,
int charset,
bool bVert,
- CFX_ByteString basefont,
+ ByteString basefont,
std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert) {
CPDF_Dictionary* pFontDict = NewIndirect<CPDF_Dictionary>();
- CFX_ByteString cmap;
- CFX_ByteString ordering;
+ ByteString cmap;
+ ByteString ordering;
int supplement = 0;
CPDF_Array* pWidthArray = pFontDict->SetNewFor<CPDF_Array>("W");
switch (charset) {
@@ -875,7 +875,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
bool bCJK = charset == FX_CHARSET_ChineseTraditional ||
charset == FX_CHARSET_ChineseSimplified ||
charset == FX_CHARSET_Hangul || charset == FX_CHARSET_ShiftJIS;
- CFX_ByteString basefont = pFont->GetFamilyName();
+ ByteString basefont = pFont->GetFamilyName();
basefont.Replace(" ", "");
int flags =
CalculateFlags(pFont->IsBold(), pFont->IsItalic(), pFont->IsFixedWidth(),
@@ -958,12 +958,12 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont,
bool bTranslateName) {
LOGFONTA lfa;
memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa);
- CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName);
+ ByteString face = ByteString::FromUnicode(pLogFont->lfFaceName);
if (face.GetLength() >= LF_FACESIZE)
return nullptr;
strncpy(lfa.lfFaceName, face.c_str(),
- (face.GetLength() + 1) * sizeof(CFX_ByteString::CharType));
+ (face.GetLength() + 1) * sizeof(ByteString::CharType));
return AddWindowsFont(&lfa, bVert, bTranslateName);
}
@@ -996,7 +996,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
pLogFont->lfCharSet == FX_CHARSET_ChineseSimplified ||
pLogFont->lfCharSet == FX_CHARSET_Hangul ||
pLogFont->lfCharSet == FX_CHARSET_ShiftJIS;
- CFX_ByteString basefont;
+ ByteString basefont;
if (bTranslateName && bCJK)
basefont = FPDF_GetPSNameFromTT(hDC);
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index cc5076379e..ff80fa85c3 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -122,7 +122,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
CPDF_Dictionary* pBaseDict,
int charset,
bool bVert,
- CFX_ByteString basefont,
+ ByteString basefont,
std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert);
bool InsertDeletePDFPage(CPDF_Dictionary* pPages,
int nPagesToGo,
diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
index 434470abeb..2a57411368 100644
--- a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
+++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
@@ -23,7 +23,7 @@ CPDF_Object* FilterInvalidObjNum(CPDF_Object* obj) {
CPDF_IndirectObjectHolder::CPDF_IndirectObjectHolder()
: m_LastObjNum(0),
- m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) {}
+ m_pByteStringPool(pdfium::MakeUnique<ByteStringPool>()) {}
CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() {
m_pByteStringPool.DeleteObject(); // Make weak.
diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.h b/core/fpdfapi/parser/cpdf_indirect_object_holder.h
index b82377e5b7..ab99dd5fcc 100644
--- a/core/fpdfapi/parser/cpdf_indirect_object_holder.h
+++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.h
@@ -58,7 +58,7 @@ class CPDF_IndirectObjectHolder {
uint32_t GetLastObjNum() const { return m_LastObjNum; }
void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; }
- CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const {
+ CFX_WeakPtr<ByteStringPool> GetByteStringPool() const {
return m_pByteStringPool;
}
@@ -72,7 +72,7 @@ class CPDF_IndirectObjectHolder {
uint32_t m_LastObjNum;
std::map<uint32_t, std::unique_ptr<CPDF_Object>> m_IndirectObjs;
std::vector<std::unique_ptr<CPDF_Object>> m_OrphanObjs;
- CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool;
+ CFX_WeakPtr<ByteStringPool> m_pByteStringPool;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_
diff --git a/core/fpdfapi/parser/cpdf_name.cpp b/core/fpdfapi/parser/cpdf_name.cpp
index ae33bc7fa0..0dd9890702 100644
--- a/core/fpdfapi/parser/cpdf_name.cpp
+++ b/core/fpdfapi/parser/cpdf_name.cpp
@@ -10,8 +10,7 @@
#include "core/fxcrt/fx_stream.h"
#include "third_party/base/ptr_util.h"
-CPDF_Name::CPDF_Name(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_ByteString& str)
+CPDF_Name::CPDF_Name(CFX_WeakPtr<ByteStringPool> pPool, const ByteString& str)
: m_Name(str) {
if (pPool)
m_Name = pPool->Intern(m_Name);
@@ -27,11 +26,11 @@ std::unique_ptr<CPDF_Object> CPDF_Name::Clone() const {
return pdfium::MakeUnique<CPDF_Name>(nullptr, m_Name);
}
-CFX_ByteString CPDF_Name::GetString() const {
+ByteString CPDF_Name::GetString() const {
return m_Name;
}
-void CPDF_Name::SetString(const CFX_ByteString& str) {
+void CPDF_Name::SetString(const ByteString& str) {
m_Name = str;
}
@@ -47,11 +46,11 @@ const CPDF_Name* CPDF_Name::AsName() const {
return this;
}
-CFX_WideString CPDF_Name::GetUnicodeText() const {
+WideString CPDF_Name::GetUnicodeText() const {
return PDF_DecodeText(m_Name);
}
bool CPDF_Name::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString("/") &&
- archive->WriteString(PDF_NameEncode(GetString()).AsStringC());
+ archive->WriteString(PDF_NameEncode(GetString()).AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_name.h b/core/fpdfapi/parser/cpdf_name.h
index 616f35f9bc..72a72a3a66 100644
--- a/core/fpdfapi/parser/cpdf_name.h
+++ b/core/fpdfapi/parser/cpdf_name.h
@@ -15,22 +15,22 @@
class CPDF_Name : public CPDF_Object {
public:
- CPDF_Name(CFX_WeakPtr<CFX_ByteStringPool> pPool, const CFX_ByteString& str);
+ CPDF_Name(CFX_WeakPtr<ByteStringPool> pPool, const ByteString& str);
~CPDF_Name() override;
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
- CFX_WideString GetUnicodeText() const override;
- void SetString(const CFX_ByteString& str) override;
+ ByteString GetString() const override;
+ WideString GetUnicodeText() const override;
+ void SetString(const ByteString& str) override;
bool IsName() const override;
CPDF_Name* AsName() override;
const CPDF_Name* AsName() const override;
bool WriteTo(IFX_ArchiveStream* archive) const override;
protected:
- CFX_ByteString m_Name;
+ ByteString m_Name;
};
inline CPDF_Name* ToName(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_number.cpp b/core/fpdfapi/parser/cpdf_number.cpp
index 9afe30adca..dac1f40b7f 100644
--- a/core/fpdfapi/parser/cpdf_number.cpp
+++ b/core/fpdfapi/parser/cpdf_number.cpp
@@ -14,7 +14,7 @@ CPDF_Number::CPDF_Number(int value) : m_bInteger(true), m_Integer(value) {}
CPDF_Number::CPDF_Number(float value) : m_bInteger(false), m_Float(value) {}
-CPDF_Number::CPDF_Number(const CFX_ByteStringC& str)
+CPDF_Number::CPDF_Number(const ByteStringView& str)
: m_bInteger(FX_atonum(str, &m_Integer)) {}
CPDF_Number::~CPDF_Number() {}
@@ -48,16 +48,16 @@ const CPDF_Number* CPDF_Number::AsNumber() const {
return this;
}
-void CPDF_Number::SetString(const CFX_ByteString& str) {
- m_bInteger = FX_atonum(str.AsStringC(), &m_Integer);
+void CPDF_Number::SetString(const ByteString& str) {
+ m_bInteger = FX_atonum(str.AsStringView(), &m_Integer);
}
-CFX_ByteString CPDF_Number::GetString() const {
- return m_bInteger ? CFX_ByteString::FormatInteger(m_Integer)
- : CFX_ByteString::FormatFloat(m_Float);
+ByteString CPDF_Number::GetString() const {
+ return m_bInteger ? ByteString::FormatInteger(m_Integer)
+ : ByteString::FormatFloat(m_Float);
}
bool CPDF_Number::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString(" ") &&
- archive->WriteString(GetString().AsStringC());
+ archive->WriteString(GetString().AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_number.h b/core/fpdfapi/parser/cpdf_number.h
index 57f82274cb..661177363b 100644
--- a/core/fpdfapi/parser/cpdf_number.h
+++ b/core/fpdfapi/parser/cpdf_number.h
@@ -18,16 +18,16 @@ class CPDF_Number : public CPDF_Object {
CPDF_Number();
explicit CPDF_Number(int value);
explicit CPDF_Number(float value);
- explicit CPDF_Number(const CFX_ByteStringC& str);
+ explicit CPDF_Number(const ByteStringView& str);
~CPDF_Number() override;
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
+ ByteString GetString() const override;
float GetNumber() const override;
int GetInteger() const override;
- void SetString(const CFX_ByteString& str) override;
+ void SetString(const ByteString& str) override;
bool IsNumber() const override;
CPDF_Number* AsNumber() override;
const CPDF_Number* AsNumber() const override;
diff --git a/core/fpdfapi/parser/cpdf_object.cpp b/core/fpdfapi/parser/cpdf_object.cpp
index b35c6e5b6f..67632a040c 100644
--- a/core/fpdfapi/parser/cpdf_object.cpp
+++ b/core/fpdfapi/parser/cpdf_object.cpp
@@ -39,12 +39,12 @@ std::unique_ptr<CPDF_Object> CPDF_Object::CloneNonCyclic(
return Clone();
}
-CFX_ByteString CPDF_Object::GetString() const {
- return CFX_ByteString();
+ByteString CPDF_Object::GetString() const {
+ return ByteString();
}
-CFX_WideString CPDF_Object::GetUnicodeText() const {
- return CFX_WideString();
+WideString CPDF_Object::GetUnicodeText() const {
+ return WideString();
}
float CPDF_Object::GetNumber() const {
@@ -59,7 +59,7 @@ CPDF_Dictionary* CPDF_Object::GetDict() const {
return nullptr;
}
-void CPDF_Object::SetString(const CFX_ByteString& str) {
+void CPDF_Object::SetString(const ByteString& str) {
NOTREACHED();
}
diff --git a/core/fpdfapi/parser/cpdf_object.h b/core/fpdfapi/parser/cpdf_object.h
index a07ba677e8..4d4279f98a 100644
--- a/core/fpdfapi/parser/cpdf_object.h
+++ b/core/fpdfapi/parser/cpdf_object.h
@@ -55,13 +55,13 @@ class CPDF_Object {
virtual std::unique_ptr<CPDF_Object> CloneDirectObject() const;
virtual CPDF_Object* GetDirect() const;
- virtual CFX_ByteString GetString() const;
- virtual CFX_WideString GetUnicodeText() const;
+ virtual ByteString GetString() const;
+ virtual WideString GetUnicodeText() const;
virtual float GetNumber() const;
virtual int GetInteger() const;
virtual CPDF_Dictionary* GetDict() const;
- virtual void SetString(const CFX_ByteString& str);
+ virtual void SetString(const ByteString& str);
virtual bool IsArray() const;
virtual bool IsBoolean() const;
diff --git a/core/fpdfapi/parser/cpdf_object_walker.cpp b/core/fpdfapi/parser/cpdf_object_walker.cpp
index c6e0f0091d..cb59a05d06 100644
--- a/core/fpdfapi/parser/cpdf_object_walker.cpp
+++ b/core/fpdfapi/parser/cpdf_object_walker.cpp
@@ -57,11 +57,11 @@ class DictionaryIterator : public CPDF_ObjectWalker::SubobjectIterator {
dict_iterator_ = object()->GetDict()->begin();
}
- const CFX_ByteString& dict_key() const { return dict_key_; }
+ const ByteString& dict_key() const { return dict_key_; }
private:
CPDF_Dictionary::const_iterator dict_iterator_;
- CFX_ByteString dict_key_;
+ ByteString dict_key_;
};
class ArrayIterator : public CPDF_ObjectWalker::SubobjectIterator {
@@ -149,11 +149,11 @@ const CPDF_Object* CPDF_ObjectWalker::GetNext() {
parent_object_ = it->object();
dict_key_ = parent_object_->IsDictionary()
? static_cast<DictionaryIterator*>(it)->dict_key()
- : CFX_ByteString();
+ : ByteString();
current_depth_ = stack_.size();
}
}
- dict_key_ = CFX_ByteString();
+ dict_key_ = ByteString();
current_depth_ = 0;
return nullptr;
}
diff --git a/core/fpdfapi/parser/cpdf_object_walker.h b/core/fpdfapi/parser/cpdf_object_walker.h
index 5590440f8f..8cad3c32f3 100644
--- a/core/fpdfapi/parser/cpdf_object_walker.h
+++ b/core/fpdfapi/parser/cpdf_object_walker.h
@@ -41,7 +41,7 @@ class CPDF_ObjectWalker {
size_t current_depth() const { return current_depth_; }
const CPDF_Object* GetParent() const { return parent_object_; }
- const CFX_ByteString& dictionary_key() const { return dict_key_; }
+ const ByteString& dictionary_key() const { return dict_key_; }
private:
static std::unique_ptr<SubobjectIterator> MakeIterator(
@@ -50,7 +50,7 @@ class CPDF_ObjectWalker {
const CPDF_Object* next_object_;
const CPDF_Object* parent_object_;
- CFX_ByteString dict_key_;
+ ByteString dict_key_;
size_t current_depth_;
std::stack<std::unique_ptr<SubobjectIterator>> stack_;
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index a9cad02f5e..b0a8126a3d 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -239,7 +239,7 @@ CPDF_Parser::Error CPDF_Parser::StartParseInternal(CPDF_Document* pDocument) {
m_pSyntax->GetKeyword();
bool bNumber;
- CFX_ByteString xrefpos_str = m_pSyntax->GetNextWord(&bNumber);
+ ByteString xrefpos_str = m_pSyntax->GetNextWord(&bNumber);
if (!bNumber)
return FORMAT_ERROR;
@@ -314,7 +314,7 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
}
if (m_pEncryptDict) {
- CFX_ByteString filter = m_pEncryptDict->GetStringFor("Filter");
+ ByteString filter = m_pEncryptDict->GetStringFor("Filter");
if (filter != "Standard")
return HANDLER_ERROR;
@@ -364,7 +364,7 @@ bool CPDF_Parser::VerifyCrossRefV4() {
FX_FILESIZE SavedPos = m_pSyntax->GetPos();
m_pSyntax->SetPos(it.second.pos);
bool is_num = false;
- CFX_ByteString num_str = m_pSyntax->GetNextWord(&is_num);
+ ByteString num_str = m_pSyntax->GetNextWord(&is_num);
m_pSyntax->SetPos(SavedPos);
if (!is_num || num_str.IsEmpty() ||
FXSYS_atoui(num_str.c_str()) != it.first) {
@@ -593,7 +593,7 @@ bool CPDF_Parser::ParseCrossRefV4(std::vector<CrossRefObjData>* out_objects) {
while (1) {
FX_FILESIZE SavedPos = m_pSyntax->GetPos();
bool bIsNumber;
- CFX_ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
+ ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
if (word.IsEmpty()) {
return false;
}
@@ -884,7 +884,7 @@ bool CPDF_Parser::RebuildCrossRef() {
m_ObjectInfo[pRef->GetRefObjNum()].pos != 0)) {
auto it = pTrailer->begin();
while (it != pTrailer->end()) {
- const CFX_ByteString& key = it->first;
+ const ByteString& key = it->first;
CPDF_Object* pElement = it->second.get();
++it;
uint32_t dwObjNum =
@@ -903,11 +903,10 @@ bool CPDF_Parser::RebuildCrossRef() {
: std::move(pObj)));
FX_FILESIZE dwSavePos = m_pSyntax->GetPos();
- CFX_ByteString strWord = m_pSyntax->GetKeyword();
+ ByteString strWord = m_pSyntax->GetKeyword();
if (!strWord.Compare("startxref")) {
bool bNumber;
- CFX_ByteString bsOffset =
- m_pSyntax->GetNextWord(&bNumber);
+ ByteString bsOffset = m_pSyntax->GetNextWord(&bNumber);
if (bNumber)
m_LastXRefOffset = FXSYS_atoi(bsOffset.c_str());
}
@@ -1316,7 +1315,7 @@ bool CPDF_Parser::ParseLinearizedHeader() {
FX_FILESIZE SavedPos = m_pSyntax->GetPos();
bool bIsNumber;
- CFX_ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
+ ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
if (!bIsNumber)
return false;
diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h
index b4d0bee329..20bd6be9b4 100644
--- a/core/fpdfapi/parser/cpdf_parser.h
+++ b/core/fpdfapi/parser/cpdf_parser.h
@@ -63,7 +63,7 @@ class CPDF_Parser {
CPDF_Document* pDocument);
void SetPassword(const char* password) { m_Password = password; }
- CFX_ByteString GetPassword() { return m_Password; }
+ ByteString GetPassword() { return m_Password; }
CPDF_Dictionary* GetTrailer() const;
FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; }
@@ -199,7 +199,7 @@ class CPDF_Parser {
CFX_UnownedPtr<CPDF_Dictionary> m_pEncryptDict;
FX_FILESIZE m_LastXRefOffset;
std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler;
- CFX_ByteString m_Password;
+ ByteString m_Password;
std::unique_ptr<TrailerData> m_TrailerData;
std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized;
uint32_t m_dwLinearizedFirstPageXRefStartObjNum;
diff --git a/core/fpdfapi/parser/cpdf_reference.cpp b/core/fpdfapi/parser/cpdf_reference.cpp
index ce4c308d8c..2ca0bddc4f 100644
--- a/core/fpdfapi/parser/cpdf_reference.cpp
+++ b/core/fpdfapi/parser/cpdf_reference.cpp
@@ -20,9 +20,9 @@ CPDF_Object::Type CPDF_Reference::GetType() const {
return REFERENCE;
}
-CFX_ByteString CPDF_Reference::GetString() const {
+ByteString CPDF_Reference::GetString() const {
CPDF_Object* obj = SafeGetDirect();
- return obj ? obj->GetString() : CFX_ByteString();
+ return obj ? obj->GetString() : ByteString();
}
float CPDF_Reference::GetNumber() const {
diff --git a/core/fpdfapi/parser/cpdf_reference.h b/core/fpdfapi/parser/cpdf_reference.h
index ab160302fe..f564ab5b9b 100644
--- a/core/fpdfapi/parser/cpdf_reference.h
+++ b/core/fpdfapi/parser/cpdf_reference.h
@@ -24,7 +24,7 @@ class CPDF_Reference : public CPDF_Object {
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
CPDF_Object* GetDirect() const override;
- CFX_ByteString GetString() const override;
+ ByteString GetString() const override;
float GetNumber() const override;
int GetInteger() const override;
CPDF_Dictionary* GetDict() const override;
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index 03b90abf4a..b838e9cf05 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -42,12 +42,12 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
CRYPT_md5_context md5;
CRYPT_MD5Start(&md5);
CRYPT_MD5Update(&md5, passcode, 32);
- CFX_ByteString okey = pEncrypt->GetStringFor("O");
+ ByteString okey = pEncrypt->GetStringFor("O");
CRYPT_MD5Update(&md5, (uint8_t*)okey.c_str(), okey.GetLength());
uint32_t perm = pEncrypt->GetIntegerFor("P");
CRYPT_MD5Update(&md5, (uint8_t*)&perm, 4);
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetStringAt(0);
+ ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
if (!bIgnoreMeta && revision >= 3 &&
@@ -97,7 +97,7 @@ bool CPDF_SecurityHandler::OnInit(CPDF_Parser* pParser,
}
bool CPDF_SecurityHandler::CheckSecurity(int32_t key_len) {
- CFX_ByteString password = m_pParser->GetPassword();
+ ByteString password = m_pParser->GetPassword();
if (!password.IsEmpty() &&
CheckPassword(password.raw_str(), password.GetLength(), true,
m_EncryptKey, key_len)) {
@@ -113,7 +113,7 @@ uint32_t CPDF_SecurityHandler::GetPermissions() {
}
static bool LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
- const CFX_ByteString& name,
+ const ByteString& name,
int& cipher,
int& keylen) {
int Version = pEncryptDict->GetIntegerFor("V");
@@ -144,7 +144,7 @@ static bool LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
nKeyBits *= 8;
}
keylen = nKeyBits / 8;
- CFX_ByteString cipher_name = pDefFilter->GetStringFor("CFM");
+ ByteString cipher_name = pDefFilter->GetStringFor("CFM");
if (cipher_name == "AESV2" || cipher_name == "AESV3") {
cipher = FXCIPHER_AES;
}
@@ -164,10 +164,10 @@ bool CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
m_Revision = pEncryptDict->GetIntegerFor("R");
m_Permissions = pEncryptDict->GetIntegerFor("P", -1);
if (m_Version < 4)
- return LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen);
+ return LoadCryptInfo(pEncryptDict, ByteString(), m_Cipher, m_KeyLen);
- CFX_ByteString stmf_name = pEncryptDict->GetStringFor("StmF");
- CFX_ByteString strf_name = pEncryptDict->GetStringFor("StrF");
+ ByteString stmf_name = pEncryptDict->GetStringFor("StmF");
+ ByteString strf_name = pEncryptDict->GetStringFor("StrF");
if (stmf_name != strf_name)
return false;
@@ -183,8 +183,8 @@ bool CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
m_Revision = pEncryptDict->GetIntegerFor("R");
m_Permissions = pEncryptDict->GetIntegerFor("P", -1);
- CFX_ByteString strf_name;
- CFX_ByteString stmf_name;
+ ByteString strf_name;
+ ByteString stmf_name;
if (m_Version >= 4) {
stmf_name = pEncryptDict->GetStringFor("StmF");
strf_name = pEncryptDict->GetStringFor("StrF");
@@ -310,11 +310,11 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
if (!m_pEncryptDict)
return false;
- CFX_ByteString okey = m_pEncryptDict->GetStringFor("O");
+ ByteString okey = m_pEncryptDict->GetStringFor("O");
if (okey.GetLength() < 48)
return false;
- CFX_ByteString ukey = m_pEncryptDict->GetStringFor("U");
+ ByteString ukey = m_pEncryptDict->GetStringFor("U");
if (ukey.GetLength() < 48)
return false;
@@ -351,9 +351,9 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
CRYPT_SHA256Finish(&sha, digest);
}
- CFX_ByteString ekey = m_pEncryptDict
- ? m_pEncryptDict->GetStringFor(bOwner ? "OE" : "UE")
- : CFX_ByteString();
+ ByteString ekey = m_pEncryptDict
+ ? m_pEncryptDict->GetStringFor(bOwner ? "OE" : "UE")
+ : ByteString();
if (ekey.GetLength() < 32)
return false;
@@ -366,7 +366,7 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
CRYPT_AESDecrypt(&aes, key, ekey.raw_str(), 32);
CRYPT_AESSetKey(&aes, 16, key, 32, false);
CRYPT_AESSetIV(&aes, iv);
- CFX_ByteString perms = m_pEncryptDict->GetStringFor("Perms");
+ ByteString perms = m_pEncryptDict->GetStringFor("Perms");
if (perms.IsEmpty())
return false;
@@ -415,8 +415,8 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
int32_t key_len) {
CalcEncryptKey(m_pEncryptDict.Get(), password, pass_size, key, key_len,
bIgnoreEncryptMeta, m_pParser->GetIDArray());
- CFX_ByteString ukey =
- m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : CFX_ByteString();
+ ByteString ukey =
+ m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : ByteString();
if (ukey.GetLength() < 16) {
return false;
}
@@ -443,7 +443,7 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
CRYPT_MD5Update(&md5, defpasscode, 32);
CPDF_Array* pIdArray = m_pParser->GetIDArray();
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetStringAt(0);
+ ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
CRYPT_MD5Finish(&md5, ukeybuf);
@@ -452,10 +452,10 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
return memcmp(ukey.c_str(), ukeybuf, 16) == 0;
}
-CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
- uint32_t pass_size,
- int32_t key_len) {
- CFX_ByteString okey = m_pEncryptDict->GetStringFor("O");
+ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
+ uint32_t pass_size,
+ int32_t key_len) {
+ ByteString okey = m_pEncryptDict->GetStringFor("O");
uint8_t passcode[32];
for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size];
@@ -496,13 +496,13 @@ CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
while (len && defpasscode[len - 1] == okeybuf[len - 1]) {
len--;
}
- return CFX_ByteString(okeybuf, len);
+ return ByteString(okeybuf, len);
}
bool CPDF_SecurityHandler::CheckOwnerPassword(const uint8_t* password,
uint32_t pass_size,
uint8_t* key,
int32_t key_len) {
- CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len);
+ ByteString user_pass = GetUserPassword(password, pass_size, key_len);
if (CheckUserPassword(user_pass.raw_str(), user_pass.GetLength(), false, key,
key_len)) {
return true;
@@ -575,8 +575,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len);
}
}
- pEncryptDict->SetNewFor<CPDF_String>("O", CFX_ByteString(passcode, 32),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("O", ByteString(passcode, 32), false);
}
CalcEncryptKey(m_pEncryptDict.Get(), (uint8_t*)user_pass, user_size,
m_EncryptKey, key_len, false, pIdArray);
@@ -584,14 +583,13 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
uint8_t tempbuf[32];
memcpy(tempbuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len);
- pEncryptDict->SetNewFor<CPDF_String>("U", CFX_ByteString(tempbuf, 32),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("U", ByteString(tempbuf, 32), false);
} else {
CRYPT_md5_context md5;
CRYPT_MD5Start(&md5);
CRYPT_MD5Update(&md5, defpasscode, 32);
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetStringAt(0);
+ ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
uint8_t digest[32];
@@ -605,8 +603,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len);
}
CRYPT_MD5Generate(digest, 16, digest + 16);
- pEncryptDict->SetNewFor<CPDF_String>("U", CFX_ByteString(digest, 32),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("U", ByteString(digest, 32), false);
}
}
void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
@@ -640,7 +637,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
uint8_t digest[20];
CRYPT_SHA1Finish(&sha, digest);
- CFX_ByteString ukey = pEncryptDict->GetStringFor("U");
+ ByteString ukey = pEncryptDict->GetStringFor("U");
CRYPT_sha2_context sha2;
uint8_t digest1[48];
if (m_Revision >= 6) {
@@ -657,7 +654,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
}
memcpy(digest1 + 32, digest, 16);
pEncryptDict->SetNewFor<CPDF_String>(bOwner ? "O" : "U",
- CFX_ByteString(digest1, 48), false);
+ ByteString(digest1, 48), false);
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest + 8,
bOwner ? ukey.raw_str() : nullptr, digest1);
@@ -678,7 +675,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
CRYPT_AESSetIV(&aes, iv);
CRYPT_AESEncrypt(&aes, digest1, key, 32);
pEncryptDict->SetNewFor<CPDF_String>(bOwner ? "OE" : "UE",
- CFX_ByteString(digest1, 32), false);
+ ByteString(digest1, 32), false);
}
void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
@@ -709,6 +706,5 @@ void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
uint8_t buf1[16];
CRYPT_AESEncrypt(&aes, buf1, buf, 16);
- pEncryptDict->SetNewFor<CPDF_String>("Perms", CFX_ByteString(buf1, 16),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("Perms", ByteString(buf1, 16), false);
}
diff --git a/core/fpdfapi/parser/cpdf_security_handler.h b/core/fpdfapi/parser/cpdf_security_handler.h
index 27f7f7c610..eb7d13f2e6 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.h
+++ b/core/fpdfapi/parser/cpdf_security_handler.h
@@ -46,9 +46,9 @@ class CPDF_SecurityHandler {
uint32_t user_size,
uint32_t type = PDF_ENCRYPT_CONTENT);
- CFX_ByteString GetUserPassword(const uint8_t* owner_pass,
- uint32_t pass_size,
- int32_t key_len);
+ ByteString GetUserPassword(const uint8_t* owner_pass,
+ uint32_t pass_size,
+ int32_t key_len);
bool CheckPassword(const uint8_t* password,
uint32_t pass_size,
bool bOwner,
diff --git a/core/fpdfapi/parser/cpdf_simple_parser.cpp b/core/fpdfapi/parser/cpdf_simple_parser.cpp
index 650c216e05..d800796d58 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser.cpp
@@ -11,7 +11,7 @@
CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize)
: m_pData(pData), m_dwSize(dwSize), m_dwCurPos(0) {}
-CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str)
+CPDF_SimpleParser::CPDF_SimpleParser(const ByteStringView& str)
: m_pData(str.raw_str()), m_dwSize(str.GetLength()), m_dwCurPos(0) {}
void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) {
@@ -91,7 +91,7 @@ void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) {
}
}
-CFX_ByteStringC CPDF_SimpleParser::GetWord() {
+ByteStringView CPDF_SimpleParser::GetWord() {
const uint8_t* pStart;
uint32_t dwSize;
ParseWord(pStart, dwSize);
@@ -102,8 +102,8 @@ CFX_ByteStringC CPDF_SimpleParser::GetWord() {
if (m_dwCurPos < m_dwSize) {
m_dwCurPos++;
}
- return CFX_ByteStringC(pStart,
- (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
+ return ByteStringView(pStart,
+ (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
}
if (dwSize == 1 && pStart[0] == '(') {
int level = 1;
@@ -130,13 +130,13 @@ CFX_ByteStringC CPDF_SimpleParser::GetWord() {
if (m_dwCurPos < m_dwSize) {
m_dwCurPos++;
}
- return CFX_ByteStringC(pStart,
- (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
+ return ByteStringView(pStart,
+ (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
}
- return CFX_ByteStringC(pStart, dwSize);
+ return ByteStringView(pStart, dwSize);
}
-bool CPDF_SimpleParser::FindTagParamFromStart(const CFX_ByteStringC& token,
+bool CPDF_SimpleParser::FindTagParamFromStart(const ByteStringView& token,
int nParams) {
nParams++;
uint32_t* pBuf = FX_Alloc(uint32_t, nParams);
@@ -152,7 +152,7 @@ bool CPDF_SimpleParser::FindTagParamFromStart(const CFX_ByteStringC& token,
if (buf_count > nParams) {
buf_count = nParams;
}
- CFX_ByteStringC word = GetWord();
+ ByteStringView word = GetWord();
if (word.IsEmpty()) {
FX_Free(pBuf);
return false;
diff --git a/core/fpdfapi/parser/cpdf_simple_parser.h b/core/fpdfapi/parser/cpdf_simple_parser.h
index 0ff6985660..72cf700f60 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser.h
+++ b/core/fpdfapi/parser/cpdf_simple_parser.h
@@ -13,13 +13,13 @@
class CPDF_SimpleParser {
public:
CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize);
- explicit CPDF_SimpleParser(const CFX_ByteStringC& str);
+ explicit CPDF_SimpleParser(const ByteStringView& str);
- CFX_ByteStringC GetWord();
+ ByteStringView GetWord();
// Find the token and its |nParams| parameters from the start of data,
// and move the current position to the start of those parameters.
- bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams);
+ bool FindTagParamFromStart(const ByteStringView& token, int nParams);
// For testing only.
uint32_t GetCurPos() const { return m_dwCurPos; }
diff --git a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
index bdb532d3e0..a2f43386e7 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
@@ -50,7 +50,7 @@ TEST(SimpleParserTest, GetWord) {
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
const pdfium::StrFuncTestData& data = test_data[i];
CPDF_SimpleParser parser(data.input, data.input_size);
- CFX_ByteStringC word = parser.GetWord();
+ ByteStringView word = parser.GetWord();
EXPECT_EQ(std::string(reinterpret_cast<const char*>(data.expected),
data.expected_size),
std::string(word.unterminated_c_str(), word.GetLength()))
diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp
index fadaec1b7e..c00096df8b 100644
--- a/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_stream.cpp
@@ -145,7 +145,7 @@ bool CPDF_Stream::HasFilter() const {
return m_pDict && m_pDict->KeyExist("Filter");
}
-CFX_WideString CPDF_Stream::GetUnicodeText() const {
+WideString CPDF_Stream::GetUnicodeText() const {
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(this);
pAcc->LoadAllData(false);
return PDF_DecodeText(pAcc->GetData(), pAcc->GetSize());
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h
index 3c3b674a48..be70e05e72 100644
--- a/core/fpdfapi/parser/cpdf_stream.h
+++ b/core/fpdfapi/parser/cpdf_stream.h
@@ -30,7 +30,7 @@ class CPDF_Stream : public CPDF_Object {
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
CPDF_Dictionary* GetDict() const override;
- CFX_WideString GetUnicodeText() const override;
+ WideString GetUnicodeText() const override;
bool IsStream() const override;
CPDF_Stream* AsStream() override;
const CPDF_Stream* AsStream() const override;
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index bc03cb097b..2161dd1950 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -34,7 +34,7 @@ class CPDF_StreamAcc : public CFX_Retainable {
const uint8_t* GetData() const;
uint32_t GetSize() const;
- const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; }
+ const ByteString& GetImageDecoder() const { return m_ImageDecoder; }
const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; }
std::unique_ptr<uint8_t, FxFreeDeleter> DetachData();
@@ -45,7 +45,7 @@ class CPDF_StreamAcc : public CFX_Retainable {
uint8_t* m_pData;
uint32_t m_dwSize;
bool m_bNewBuf;
- CFX_ByteString m_ImageDecoder;
+ ByteString m_ImageDecoder;
CPDF_Dictionary* m_pImageParam;
CFX_UnownedPtr<const CPDF_Stream> const m_pStream;
uint8_t* m_pSrcData;
diff --git a/core/fpdfapi/parser/cpdf_string.cpp b/core/fpdfapi/parser/cpdf_string.cpp
index 6ce6bf3473..1539861622 100644
--- a/core/fpdfapi/parser/cpdf_string.cpp
+++ b/core/fpdfapi/parser/cpdf_string.cpp
@@ -14,16 +14,16 @@
CPDF_String::CPDF_String() : m_bHex(false) {}
-CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_ByteString& str,
+CPDF_String::CPDF_String(CFX_WeakPtr<ByteStringPool> pPool,
+ const ByteString& str,
bool bHex)
: m_String(str), m_bHex(bHex) {
if (pPool)
m_String = pPool->Intern(m_String);
}
-CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_WideString& str)
+CPDF_String::CPDF_String(CFX_WeakPtr<ByteStringPool> pPool,
+ const WideString& str)
: m_String(PDF_EncodeText(str)), m_bHex(false) {
if (pPool)
m_String = pPool->Intern(m_String);
@@ -42,11 +42,11 @@ std::unique_ptr<CPDF_Object> CPDF_String::Clone() const {
return std::move(pRet);
}
-CFX_ByteString CPDF_String::GetString() const {
+ByteString CPDF_String::GetString() const {
return m_String;
}
-void CPDF_String::SetString(const CFX_ByteString& str) {
+void CPDF_String::SetString(const ByteString& str) {
m_String = str;
}
@@ -62,11 +62,11 @@ const CPDF_String* CPDF_String::AsString() const {
return this;
}
-CFX_WideString CPDF_String::GetUnicodeText() const {
+WideString CPDF_String::GetUnicodeText() const {
return PDF_DecodeText(m_String);
}
bool CPDF_String::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString(
- PDF_EncodeString(GetString(), IsHex()).AsStringC());
+ PDF_EncodeString(GetString(), IsHex()).AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_string.h b/core/fpdfapi/parser/cpdf_string.h
index ccd6f530c1..9fd3e6ae8a 100644
--- a/core/fpdfapi/parser/cpdf_string.h
+++ b/core/fpdfapi/parser/cpdf_string.h
@@ -18,18 +18,18 @@
class CPDF_String : public CPDF_Object {
public:
CPDF_String();
- CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_ByteString& str,
+ CPDF_String(CFX_WeakPtr<ByteStringPool> pPool,
+ const ByteString& str,
bool bHex);
- CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool, const CFX_WideString& str);
+ CPDF_String(CFX_WeakPtr<ByteStringPool> pPool, const WideString& str);
~CPDF_String() override;
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
- CFX_WideString GetUnicodeText() const override;
- void SetString(const CFX_ByteString& str) override;
+ ByteString GetString() const override;
+ WideString GetUnicodeText() const override;
+ void SetString(const ByteString& str) override;
bool IsString() const override;
CPDF_String* AsString() override;
const CPDF_String* AsString() const override;
@@ -38,7 +38,7 @@ class CPDF_String : public CPDF_Object {
bool IsHex() const { return m_bHex; }
protected:
- CFX_ByteString m_String;
+ ByteString m_String;
bool m_bHex;
};
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 779bf81e0f..4412105c7b 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -41,10 +41,9 @@ enum class ReadStatus { Normal, Backslash, Octal, FinishOctal, CarriageReturn };
int CPDF_SyntaxParser::s_CurrentRecursionDepth = 0;
CPDF_SyntaxParser::CPDF_SyntaxParser()
- : CPDF_SyntaxParser(CFX_WeakPtr<CFX_ByteStringPool>()) {}
+ : CPDF_SyntaxParser(CFX_WeakPtr<ByteStringPool>()) {}
-CPDF_SyntaxParser::CPDF_SyntaxParser(
- const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_SyntaxParser::CPDF_SyntaxParser(const CFX_WeakPtr<ByteStringPool>& pPool)
: m_MetadataObjnum(0),
m_pFileAccess(nullptr),
m_pFileBuf(nullptr),
@@ -187,10 +186,10 @@ void CPDF_SyntaxParser::GetNextWordInternal(bool* bIsNumber) {
}
}
-CFX_ByteString CPDF_SyntaxParser::ReadString() {
+ByteString CPDF_SyntaxParser::ReadString() {
uint8_t ch;
if (!GetNextChar(ch))
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
int32_t parlevel = 0;
@@ -201,7 +200,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
case ReadStatus::Normal:
if (ch == ')') {
if (parlevel == 0)
- return CFX_ByteString(buf);
+ return ByteString(buf);
parlevel--;
} else if (ch == '(') {
parlevel++;
@@ -270,13 +269,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
}
GetNextChar(ch);
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
-CFX_ByteString CPDF_SyntaxParser::ReadHexString() {
+ByteString CPDF_SyntaxParser::ReadHexString() {
uint8_t ch;
if (!GetNextChar(ch))
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
bool bFirst = true;
@@ -302,7 +301,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() {
if (!bFirst)
buf << static_cast<char>(code);
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
void CPDF_SyntaxParser::ToNextLine() {
@@ -344,20 +343,20 @@ void CPDF_SyntaxParser::ToNextWord() {
m_Pos--;
}
-CFX_ByteString CPDF_SyntaxParser::GetNextWord(bool* bIsNumber) {
+ByteString CPDF_SyntaxParser::GetNextWord(bool* bIsNumber) {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
GetNextWordInternal(bIsNumber);
return GetValidator()->has_read_problems()
- ? CFX_ByteString()
- : CFX_ByteString((const char*)m_WordBuffer, m_WordSize);
+ ? ByteString()
+ : ByteString((const char*)m_WordBuffer, m_WordSize);
}
-CFX_ByteString CPDF_SyntaxParser::PeekNextWord(bool* bIsNumber) {
+ByteString CPDF_SyntaxParser::PeekNextWord(bool* bIsNumber) {
const CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
return GetNextWord(bIsNumber);
}
-CFX_ByteString CPDF_SyntaxParser::GetKeyword() {
+ByteString CPDF_SyntaxParser::GetKeyword() {
return GetNextWord(nullptr);
}
@@ -386,15 +385,15 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
FX_FILESIZE SavedObjPos = m_Pos;
bool bIsNumber;
- CFX_ByteString word = GetNextWord(&bIsNumber);
+ ByteString word = GetNextWord(&bIsNumber);
if (word.GetLength() == 0)
return nullptr;
if (bIsNumber) {
FX_FILESIZE SavedPos = m_Pos;
- CFX_ByteString nextword = GetNextWord(&bIsNumber);
+ ByteString nextword = GetNextWord(&bIsNumber);
if (bIsNumber) {
- CFX_ByteString nextword2 = GetNextWord(nullptr);
+ ByteString nextword2 = GetNextWord(nullptr);
if (nextword2 == "R") {
uint32_t refnum = FXSYS_atoui(word.c_str());
if (refnum == CPDF_Object::kInvalidObjNum)
@@ -403,7 +402,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
}
}
m_Pos = SavedPos;
- return pdfium::MakeUnique<CPDF_Number>(word.AsStringC());
+ return pdfium::MakeUnique<CPDF_Number>(word.AsStringView());
}
if (word == "true" || word == "false")
@@ -413,13 +412,13 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
return pdfium::MakeUnique<CPDF_Null>();
if (word == "(") {
- CFX_ByteString str = ReadString();
+ ByteString str = ReadString();
if (m_pCryptoHandler && bDecrypt)
str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false);
}
if (word == "<") {
- CFX_ByteString str = ReadHexString();
+ ByteString str = ReadHexString();
if (m_pCryptoHandler && bDecrypt)
str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, true);
@@ -437,14 +436,14 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
if (word[0] == '/') {
return pdfium::MakeUnique<CPDF_Name>(
m_pPool,
- PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
+ PDF_NameDecode(ByteStringView(m_WordBuffer + 1, m_WordSize - 1)));
}
if (word == "<<") {
FX_FILESIZE dwSignValuePos = 0;
std::unique_ptr<CPDF_Dictionary> pDict =
pdfium::MakeUnique<CPDF_Dictionary>(m_pPool);
while (1) {
- CFX_ByteString key = GetNextWord(nullptr);
+ ByteString key = GetNextWord(nullptr);
if (key.IsEmpty())
return nullptr;
@@ -477,7 +476,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
}
if (!key.IsEmpty()) {
- CFX_ByteString keyNoSlash(key.raw_str() + 1, key.GetLength() - 1);
+ ByteString keyNoSlash(key.raw_str() + 1, key.GetLength() - 1);
pDict->SetFor(keyNoSlash, std::move(pObj));
}
}
@@ -492,7 +491,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
}
FX_FILESIZE SavedPos = m_Pos;
- CFX_ByteString nextword = GetNextWord(nullptr);
+ ByteString nextword = GetNextWord(nullptr);
if (nextword != "stream") {
m_Pos = SavedPos;
return std::move(pDict);
@@ -526,7 +525,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetIndirectObject(
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
const FX_FILESIZE saved_pos = GetPos();
bool is_number = false;
- CFX_ByteString word = GetNextWord(&is_number);
+ ByteString word = GetNextWord(&is_number);
if (!is_number || word.IsEmpty()) {
SetPos(saved_pos);
return nullptr;
@@ -588,8 +587,8 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream(
ToNextLine();
FX_FILESIZE streamStartPos = m_Pos;
- const CFX_ByteStringC kEndStreamStr("endstream");
- const CFX_ByteStringC kEndObjStr("endobj");
+ const ByteStringView kEndStreamStr("endstream");
+ const ByteStringView kEndObjStr("endobj");
CPDF_CryptoHandler* pCryptoHandler =
objnum == m_MetadataObjnum ? nullptr : m_pCryptoHandler.Get();
@@ -757,7 +756,7 @@ uint32_t CPDF_SyntaxParser::GetDirectNum() {
bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
- const CFX_ByteStringC& tag,
+ const ByteStringView& tag,
bool checkKeyword) {
const uint32_t taglen = tag.GetLength();
@@ -783,7 +782,7 @@ bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
return true;
}
-bool CPDF_SyntaxParser::BackwardsSearchToWord(const CFX_ByteStringC& tag,
+bool CPDF_SyntaxParser::BackwardsSearchToWord(const ByteStringView& tag,
FX_FILESIZE limit) {
int32_t taglen = tag.GetLength();
if (taglen == 0)
@@ -817,7 +816,7 @@ bool CPDF_SyntaxParser::BackwardsSearchToWord(const CFX_ByteStringC& tag,
}
}
-FX_FILESIZE CPDF_SyntaxParser::FindTag(const CFX_ByteStringC& tag,
+FX_FILESIZE CPDF_SyntaxParser::FindTag(const ByteStringView& tag,
FX_FILESIZE limit) {
int32_t taglen = tag.GetLength();
int32_t match = 0;
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h
index 179058edf8..4e28c2fb92 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.h
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.h
@@ -26,7 +26,7 @@ class CPDF_SyntaxParser {
enum class ParseType { kStrict, kLoose };
CPDF_SyntaxParser();
- explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ explicit CPDF_SyntaxParser(const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_SyntaxParser();
void InitParser(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess,
@@ -56,16 +56,16 @@ class CPDF_SyntaxParser {
bool bDecrypt,
ParseType parse_type);
- CFX_ByteString GetKeyword();
+ ByteString GetKeyword();
void ToNextLine();
void ToNextWord();
- bool BackwardsSearchToWord(const CFX_ByteStringC& word, FX_FILESIZE limit);
- FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit);
+ bool BackwardsSearchToWord(const ByteStringView& word, FX_FILESIZE limit);
+ FX_FILESIZE FindTag(const ByteStringView& tag, FX_FILESIZE limit);
void SetEncrypt(const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler);
bool ReadBlock(uint8_t* pBuf, uint32_t size);
bool GetCharAt(FX_FILESIZE pos, uint8_t& ch);
- CFX_ByteString GetNextWord(bool* bIsNumber);
- CFX_ByteString PeekNextWord(bool* bIsNumber);
+ ByteString GetNextWord(bool* bIsNumber);
+ ByteString PeekNextWord(bool* bIsNumber);
CFX_RetainPtr<IFX_SeekableReadStream> GetFileAccess() const;
@@ -88,11 +88,11 @@ class CPDF_SyntaxParser {
void GetNextWordInternal(bool* bIsNumber);
bool IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
- const CFX_ByteStringC& tag,
+ const ByteStringView& tag,
bool checkKeyword);
- CFX_ByteString ReadString();
- CFX_ByteString ReadHexString();
+ ByteString ReadString();
+ ByteString ReadHexString();
unsigned int ReadEOLMarkers(FX_FILESIZE pos);
std::unique_ptr<CPDF_Stream> ReadStream(
std::unique_ptr<CPDF_Dictionary> pDict,
@@ -122,7 +122,7 @@ class CPDF_SyntaxParser {
CFX_RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
uint8_t m_WordBuffer[257];
uint32_t m_WordSize;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 77024f2f09..0180aaf749 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -328,7 +328,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
bool bImageAcc,
uint8_t** dest_buf,
uint32_t* dest_size,
- CFX_ByteString* ImageEncoding,
+ ByteString* ImageEncoding,
CPDF_Dictionary** pImageParms) {
CPDF_Object* pDecoder = pDict ? pDict->GetDirectObjectFor("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
@@ -337,7 +337,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
CPDF_Object* pParams =
pDict ? pDict->GetDirectObjectFor("DecodeParms") : nullptr;
- std::vector<std::pair<CFX_ByteString, CPDF_Object*>> DecoderArray;
+ std::vector<std::pair<ByteString, CPDF_Object*>> DecoderArray;
if (CPDF_Array* pDecoders = pDecoder->AsArray()) {
CPDF_Array* pParamsArray = ToArray(pParams);
for (size_t i = 0; i < pDecoders->GetCount(); ++i) {
@@ -354,7 +354,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
int nSize = pdfium::CollectionSize<int>(DecoderArray);
for (int i = 0; i < nSize; ++i) {
int estimated_size = i == nSize - 1 ? last_estimated_size : 0;
- CFX_ByteString decoder = DecoderArray[i].first;
+ ByteString decoder = DecoderArray[i].first;
CPDF_Dictionary* pParam = ToDictionary(DecoderArray[i].second);
uint8_t* new_buf = nullptr;
uint32_t new_size = 0xFFFFFFFF;
@@ -415,8 +415,8 @@ bool PDF_DataDecode(const uint8_t* src_buf,
return true;
}
-CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
- CFX_WideString result;
+WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
+ WideString result;
if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) ||
(src_data[0] == 0xff && src_data[1] == 0xfe))) {
bool bBE = src_data[0] == 0xfe;
@@ -455,16 +455,16 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
return result;
}
-CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr) {
+WideString PDF_DecodeText(const ByteString& bstr) {
return PDF_DecodeText(reinterpret_cast<const uint8_t*>(bstr.c_str()),
bstr.GetLength());
}
-CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len) {
+ByteString PDF_EncodeText(const wchar_t* pString, int len) {
if (len == -1)
len = FXSYS_wcslen(pString);
- CFX_ByteString result;
+ ByteString result;
char* dest_buf1 = result.GetBuffer(len);
int i;
for (i = 0; i < len; ++i) {
@@ -502,11 +502,11 @@ CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len) {
return result;
}
-CFX_ByteString PDF_EncodeText(const CFX_WideString& str) {
+ByteString PDF_EncodeText(const WideString& str) {
return PDF_EncodeText(str.c_str(), str.GetLength());
}
-CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex) {
+ByteString PDF_EncodeString(const ByteString& src, bool bHex) {
std::ostringstream result;
int srclen = src.GetLength();
if (bHex) {
@@ -518,7 +518,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex) {
result << buf[1];
}
result << '>';
- return CFX_ByteString(result);
+ return ByteString(result);
}
result << '(';
for (int i = 0; i < srclen; ++i) {
@@ -536,7 +536,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex) {
result << static_cast<char>(ch);
}
result << ')';
- return CFX_ByteString(result);
+ return ByteString(result);
}
bool FlateEncode(const uint8_t* src_buf,
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h
index 23ca0a0fae..6650b68c06 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -17,14 +17,14 @@ class CPDF_Dictionary;
// Indexed by 8-bit char code, contains unicode code points.
extern const uint16_t PDFDocEncoding[256];
-CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig);
-CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig);
-CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig);
-CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex);
-CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
-CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr);
-CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len);
-CFX_ByteString PDF_EncodeText(const CFX_WideString& str);
+ByteString PDF_NameDecode(const ByteStringView& orig);
+ByteString PDF_NameDecode(const ByteString& orig);
+ByteString PDF_NameEncode(const ByteString& orig);
+ByteString PDF_EncodeString(const ByteString& src, bool bHex);
+WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
+WideString PDF_DecodeText(const ByteString& bstr);
+ByteString PDF_EncodeText(const wchar_t* pString, int len);
+ByteString PDF_EncodeText(const WideString& str);
bool FlateEncode(const uint8_t* src_buf,
uint32_t src_size,
@@ -90,7 +90,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
bool bImageAcc,
uint8_t** dest_buf,
uint32_t* dest_size,
- CFX_ByteString* ImageEncoding,
+ ByteString* ImageEncoding,
CPDF_Dictionary** pImageParms);
#endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_DECODE_H_
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
index c8e0c7a0e1..ae30959013 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
@@ -99,7 +99,7 @@ TEST(fpdf_parser_decode, EncodeText) {
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
const auto& test_case = test_data[i];
- CFX_ByteString output = PDF_EncodeText(test_case.input);
+ ByteString output = PDF_EncodeText(test_case.input);
ASSERT_EQ(test_case.expected_length, output.GetLength()) << "for case "
<< i;
const char* str_ptr = output.c_str();
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index c6487f55a0..82804528ab 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -84,17 +84,17 @@ int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
return kInvalidHeaderOffset;
}
-int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key) {
+int32_t GetDirectInteger(CPDF_Dictionary* pDict, const ByteString& key) {
CPDF_Number* pObj = ToNumber(pDict->GetObjectFor(key));
return pObj ? pObj->GetInteger() : 0;
}
-CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
+ByteString PDF_NameDecode(const ByteStringView& bstr) {
if (!bstr.Contains('#'))
- return CFX_ByteString(bstr);
+ return ByteString(bstr);
int size = bstr.GetLength();
- CFX_ByteString result;
+ ByteString result;
char* pDestStart = result.GetBuffer(size);
char* pDest = pDestStart;
for (int i = 0; i < size; i++) {
@@ -110,11 +110,11 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
return result;
}
-CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) {
- return orig.Contains("#") ? PDF_NameDecode(orig.AsStringC()) : orig;
+ByteString PDF_NameDecode(const ByteString& orig) {
+ return orig.Contains("#") ? PDF_NameDecode(orig.AsStringView()) : orig;
}
-CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
+ByteString PDF_NameEncode(const ByteString& orig) {
uint8_t* src_buf = (uint8_t*)orig.c_str();
int src_len = orig.GetLength();
int dest_len = 0;
@@ -131,7 +131,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
if (dest_len == src_len)
return orig;
- CFX_ByteString res;
+ ByteString res;
char* dest_buf = res.GetBuffer(dest_len);
dest_len = 0;
for (i = 0; i < src_len; i++) {
@@ -167,7 +167,7 @@ std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj) {
buf << PDF_EncodeString(pObj->GetString(), pObj->AsString()->IsHex());
break;
case CPDF_Object::NAME: {
- CFX_ByteString str = pObj->GetString();
+ ByteString str = pObj->GetString();
buf << "/" << PDF_NameEncode(str);
break;
}
@@ -193,7 +193,7 @@ std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj) {
const CPDF_Dictionary* p = pObj->AsDictionary();
buf << "<<";
for (const auto& it : *p) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
buf << "/" << PDF_NameEncode(key);
if (pValue && !pValue->IsInline()) {
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.h b/core/fpdfapi/parser/fpdf_parser_utility.h
index 94ee1fcfd3..5f85551a53 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.h
+++ b/core/fpdfapi/parser/fpdf_parser_utility.h
@@ -41,7 +41,7 @@ constexpr int32_t kInvalidHeaderOffset = -1;
// |kInvalidHeaderOffset|.
int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
-int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key);
+int32_t GetDirectInteger(CPDF_Dictionary* pDict, const ByteString& key);
std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj);
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp
index f5882d9944..f286474dd8 100644
--- a/core/fpdfapi/render/cpdf_charposlist.cpp
+++ b/core/fpdfapi/render/cpdf_charposlist.cpp
@@ -37,7 +37,7 @@ void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes,
FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++];
if (pCIDFont)
charpos.m_bFontStyle = true;
- CFX_WideString unicode = pFont->UnicodeFromCharCode(CharCode);
+ WideString unicode = pFont->UnicodeFromCharCode(CharCode);
charpos.m_Unicode = !unicode.IsEmpty() ? unicode[0] : CharCode;
charpos.m_GlyphIndex = pFont->GlyphFromCharCode(CharCode, &bVert);
uint32_t GlyphID = charpos.m_GlyphIndex;
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index 08bde6ed8d..86a01c596c 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -317,7 +317,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
int CPDF_DIBSource::ContinueLoadDIBSource(IFX_PauseIndicator* pPause) {
FXCODEC_STATUS ret;
if (m_Status == 1) {
- const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder();
+ const ByteString& decoder = m_pStreamAcc->GetImageDecoder();
if (decoder == "JPXDecode") {
return 0;
}
@@ -397,7 +397,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
if (!m_bImageMask) {
CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter");
if (pFilter) {
- CFX_ByteString filter;
+ ByteString filter;
if (pFilter->IsName()) {
filter = pFilter->GetString();
} else if (CPDF_Array* pArray = pFilter->AsArray()) {
@@ -432,7 +432,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
m_Family = m_pColorSpace->GetFamily();
m_nComponents = m_pColorSpace->CountComponents();
if (m_Family == PDFCS_ICCBASED && pCSObj->IsName()) {
- CFX_ByteString cs = pCSObj->GetString();
+ ByteString cs = pCSObj->GetString();
if (cs == "DeviceGray")
m_nComponents = 1;
else if (cs == "DeviceRGB")
@@ -500,7 +500,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool* bDefaultDecode,
}
int CPDF_DIBSource::CreateDecoder() {
- const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder();
+ const ByteString& decoder = m_pStreamAcc->GetImageDecoder();
if (decoder.IsEmpty())
return 1;
@@ -841,7 +841,7 @@ void CPDF_DIBSource::ValidateDictParam() {
CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter");
if (pFilter) {
if (pFilter->IsName()) {
- CFX_ByteString filter = pFilter->GetString();
+ ByteString filter = pFilter->GetString();
if (filter == "CCITTFaxDecode" || filter == "JBIG2Decode") {
m_bpc = 1;
m_nComponents = 1;
@@ -853,7 +853,7 @@ void CPDF_DIBSource::ValidateDictParam() {
m_bpc = 8;
}
} else if (CPDF_Array* pArray = pFilter->AsArray()) {
- CFX_ByteString filter = pArray->GetStringAt(pArray->GetCount() - 1);
+ ByteString filter = pArray->GetStringAt(pArray->GetCount() - 1);
if (filter == "CCITTFaxDecode" || filter == "JBIG2Decode") {
m_bpc = 1;
m_nComponents = 1;
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index fafa18e5a4..75a381c8fc 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -556,7 +556,7 @@ void CPDF_ImageRenderer::HandleFilters() {
return;
if (pFilters->IsName()) {
- CFX_ByteString bsDecodeType = pFilters->GetString();
+ ByteString bsDecodeType = pFilters->GetString();
if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode")
m_Flags |= FXRENDER_IMAGE_LOSSY;
return;
@@ -567,7 +567,7 @@ void CPDF_ImageRenderer::HandleFilters() {
return;
for (size_t i = 0; i < pArray->GetCount(); i++) {
- CFX_ByteString bsDecodeType = pArray->GetStringAt(i);
+ ByteString bsDecodeType = pArray->GetStringAt(i);
if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") {
m_Flags |= FXRENDER_IMAGE_LOSSY;
break;
diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp
index 83e61478da..283d9946fa 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -76,7 +76,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
CPDF_Font* pFont,
float font_size,
const CFX_Matrix* pMatrix,
- const CFX_ByteString& str,
+ const ByteString& str,
FX_ARGB fill_argb,
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions) {
diff --git a/core/fpdfapi/render/cpdf_textrenderer.h b/core/fpdfapi/render/cpdf_textrenderer.h
index 31c44d9599..ac8c8c5568 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.h
+++ b/core/fpdfapi/render/cpdf_textrenderer.h
@@ -28,7 +28,7 @@ class CPDF_TextRenderer {
CPDF_Font* pFont,
float font_size,
const CFX_Matrix* matrix,
- const CFX_ByteString& str,
+ const ByteString& str,
FX_ARGB fill_argb,
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions);
diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp
index f113e7a862..b87b5ef74a 100644
--- a/core/fpdfapi/render/cpdf_type3cache.cpp
+++ b/core/fpdfapi/render/cpdf_type3cache.cpp
@@ -92,7 +92,7 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode,
keygen.Generate(
4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000),
FXSYS_round(pMatrix->c * 10000), FXSYS_round(pMatrix->d * 10000));
- CFX_ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
+ ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
CPDF_Type3Glyphs* pSizeCache;
auto it = m_SizeMap.find(FaceGlyphsKey);
if (it == m_SizeMap.end()) {
diff --git a/core/fpdfapi/render/cpdf_type3cache.h b/core/fpdfapi/render/cpdf_type3cache.h
index 36a1d6f98a..ab748ba989 100644
--- a/core/fpdfapi/render/cpdf_type3cache.h
+++ b/core/fpdfapi/render/cpdf_type3cache.h
@@ -39,7 +39,7 @@ class CPDF_Type3Cache : public CFX_Retainable {
float retinaScaleY);
CFX_UnownedPtr<CPDF_Type3Font> const m_pFont;
- std::map<CFX_ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap;
+ std::map<ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_
diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp
index 4d9e630d97..9d28bc1f82 100644
--- a/core/fpdfdoc/cpdf_action.cpp
+++ b/core/fpdfdoc/cpdf_action.cpp
@@ -33,7 +33,7 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const {
if (!m_pDict)
return CPDF_Dest();
- CFX_ByteString type = m_pDict->GetStringFor("S");
+ ByteString type = m_pDict->GetStringFor("S");
if (type != "GoTo" && type != "GoToR")
return CPDF_Dest();
@@ -54,7 +54,7 @@ CPDF_Action::ActionType CPDF_Action::GetType() const {
if (!m_pDict)
return Unknown;
- CFX_ByteString csType = m_pDict->GetStringFor("S");
+ ByteString csType = m_pDict->GetStringFor("S");
if (csType.IsEmpty())
return Unknown;
@@ -65,11 +65,11 @@ CPDF_Action::ActionType CPDF_Action::GetType() const {
return Unknown;
}
-CFX_WideString CPDF_Action::GetFilePath() const {
- CFX_ByteString type = m_pDict->GetStringFor("S");
+WideString CPDF_Action::GetFilePath() const {
+ ByteString type = m_pDict->GetStringFor("S");
if (type != "GoToR" && type != "Launch" && type != "SubmitForm" &&
type != "ImportData") {
- return CFX_WideString();
+ return WideString();
}
CPDF_Object* pFile = m_pDict->GetDirectObjectFor("F");
@@ -79,14 +79,14 @@ CFX_WideString CPDF_Action::GetFilePath() const {
if (type == "Launch") {
CPDF_Dictionary* pWinDict = m_pDict->GetDictFor("Win");
if (pWinDict) {
- return CFX_WideString::FromLocal(pWinDict->GetStringFor("F").AsStringC());
+ return WideString::FromLocal(pWinDict->GetStringFor("F").AsStringView());
}
}
- return CFX_WideString();
+ return WideString();
}
-CFX_ByteString CPDF_Action::GetURI(const CPDF_Document* pDoc) const {
- CFX_ByteString csURI;
+ByteString CPDF_Action::GetURI(const CPDF_Document* pDoc) const {
+ ByteString csURI;
if (!m_pDict)
return csURI;
if (m_pDict->GetStringFor("S") != "URI")
@@ -103,8 +103,8 @@ CFX_ByteString CPDF_Action::GetURI(const CPDF_Document* pDoc) const {
return csURI;
}
-CFX_WideString CPDF_Action::GetJavaScript() const {
- CFX_WideString csJS;
+WideString CPDF_Action::GetJavaScript() const {
+ WideString csJS;
if (!m_pDict)
return csJS;
diff --git a/core/fpdfdoc/cpdf_action.h b/core/fpdfdoc/cpdf_action.h
index be4d461867..b405f226a5 100644
--- a/core/fpdfdoc/cpdf_action.h
+++ b/core/fpdfdoc/cpdf_action.h
@@ -45,12 +45,12 @@ class CPDF_Action {
CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
ActionType GetType() const;
CPDF_Dest GetDest(CPDF_Document* pDoc) const;
- CFX_WideString GetFilePath() const;
- CFX_ByteString GetURI(const CPDF_Document* pDoc) const;
+ WideString GetFilePath() const;
+ ByteString GetURI(const CPDF_Document* pDoc) const;
bool GetHideStatus() const { return m_pDict->GetBooleanFor("H", true); }
- CFX_ByteString GetNamedAction() const { return m_pDict->GetStringFor("N"); }
+ ByteString GetNamedAction() const { return m_pDict->GetStringFor("N"); }
uint32_t GetFlags() const { return m_pDict->GetIntegerFor("Flags"); }
- CFX_WideString GetJavaScript() const;
+ WideString GetJavaScript() const;
size_t GetSubActionsCount() const;
CPDF_Action GetSubAction(size_t iIndex) const;
diff --git a/core/fpdfdoc/cpdf_actionfields.cpp b/core/fpdfdoc/cpdf_actionfields.cpp
index f3c3f5ed25..cee256d3fb 100644
--- a/core/fpdfdoc/cpdf_actionfields.cpp
+++ b/core/fpdfdoc/cpdf_actionfields.cpp
@@ -23,7 +23,7 @@ size_t CPDF_ActionFields::GetFieldsCount() const {
if (!pDict)
return 0;
- CFX_ByteString csType = pDict->GetStringFor("S");
+ ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields = nullptr;
if (csType == "Hide")
pFields = pDict->GetDirectObjectFor("T");
@@ -50,7 +50,7 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const {
if (!pDict)
return fields;
- CFX_ByteString csType = pDict->GetStringFor("S");
+ ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields;
if (csType == "Hide")
pFields = pDict->GetDirectObjectFor("T");
@@ -80,7 +80,7 @@ CPDF_Object* CPDF_ActionFields::GetField(size_t iIndex) const {
if (!pDict)
return nullptr;
- CFX_ByteString csType = pDict->GetStringFor("S");
+ ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields = nullptr;
if (csType == "Hide")
pFields = pDict->GetDirectObjectFor("T");
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index ea15436565..1a8538057c 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -179,12 +179,12 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(const CPDF_Dictionary* pAnnotDict,
return pStream;
if (CPDF_Dictionary* pDict = psub->AsDictionary()) {
- CFX_ByteString as = pAnnotDict->GetStringFor("AS");
+ ByteString as = pAnnotDict->GetStringFor("AS");
if (as.IsEmpty()) {
- CFX_ByteString value = pAnnotDict->GetStringFor("V");
+ ByteString value = pAnnotDict->GetStringFor("V");
if (value.IsEmpty()) {
CPDF_Dictionary* pParentDict = pAnnotDict->GetDictFor("Parent");
- value = pParentDict ? pParentDict->GetStringFor("V") : CFX_ByteString();
+ value = pParentDict ? pParentDict->GetStringFor("V") : ByteString();
}
if (value.IsEmpty() || !pDict->KeyExist(value))
as = "Off";
@@ -241,7 +241,7 @@ bool CPDF_Annot::IsAnnotationHidden(CPDF_Dictionary* pAnnotDict) {
// Static.
CPDF_Annot::Subtype CPDF_Annot::StringToAnnotSubtype(
- const CFX_ByteString& sSubtype) {
+ const ByteString& sSubtype) {
if (sSubtype == "Text")
return CPDF_Annot::Subtype::TEXT;
if (sSubtype == "Link")
@@ -300,7 +300,7 @@ CPDF_Annot::Subtype CPDF_Annot::StringToAnnotSubtype(
}
// Static.
-CFX_ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) {
+ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) {
if (nSubtype == CPDF_Annot::Subtype::TEXT)
return "Text";
if (nSubtype == CPDF_Annot::Subtype::LINK)
@@ -456,7 +456,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
width = 1;
}
} else {
- CFX_ByteString style = pBS->GetStringFor("S");
+ ByteString style = pBS->GetStringFor("S");
pDashArray = pBS->GetArrayFor("D");
style_char = style[1];
width = pBS->GetNumberFor("W");
diff --git a/core/fpdfdoc/cpdf_annot.h b/core/fpdfdoc/cpdf_annot.h
index 4ca1941819..cf1b304670 100644
--- a/core/fpdfdoc/cpdf_annot.h
+++ b/core/fpdfdoc/cpdf_annot.h
@@ -69,9 +69,8 @@ class CPDF_Annot {
};
static bool IsAnnotationHidden(CPDF_Dictionary* pAnnotDict);
- static CPDF_Annot::Subtype StringToAnnotSubtype(
- const CFX_ByteString& sSubtype);
- static CFX_ByteString AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype);
+ static CPDF_Annot::Subtype StringToAnnotSubtype(const ByteString& sSubtype);
+ static ByteString AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype);
static CFX_FloatRect RectFromQuadPoints(CPDF_Dictionary* pAnnotDict);
// The second constructor does not take ownership of the dictionary.
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index df3b631626..87e5ba7808 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -35,7 +35,7 @@ std::unique_ptr<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot,
// TODO(jaepark): We shouldn't strip BOM for some strings and not for others.
// See pdfium:593.
- CFX_WideString sContents = pParentDict->GetUnicodeTextFor("Contents");
+ WideString sContents = pParentDict->GetUnicodeTextFor("Contents");
if (sContents.IsEmpty())
return nullptr;
@@ -92,7 +92,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i));
if (!pDict)
continue;
- const CFX_ByteString subtype = pDict->GetStringFor("Subtype");
+ const ByteString subtype = pDict->GetStringFor("Subtype");
if (subtype == "Popup") {
// Skip creating Popup annotations in the PDF document since PDFium
// provides its own Popup annotations.
diff --git a/core/fpdfdoc/cpdf_apsettings.cpp b/core/fpdfdoc/cpdf_apsettings.cpp
index ee205e01dc..0fc9c202cb 100644
--- a/core/fpdfdoc/cpdf_apsettings.cpp
+++ b/core/fpdfdoc/cpdf_apsettings.cpp
@@ -18,7 +18,7 @@ CPDF_ApSettings::CPDF_ApSettings(const CPDF_ApSettings& that) = default;
CPDF_ApSettings::~CPDF_ApSettings() {}
-bool CPDF_ApSettings::HasMKEntry(const CFX_ByteString& csEntry) const {
+bool CPDF_ApSettings::HasMKEntry(const ByteString& csEntry) const {
return m_pDict && m_pDict->KeyExist(csEntry);
}
@@ -27,7 +27,7 @@ int CPDF_ApSettings::GetRotation() const {
}
FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
- const CFX_ByteString& csEntry) const {
+ const ByteString& csEntry) const {
iColorType = COLORTYPE_TRANSPARENT;
if (!m_pDict)
return 0;
@@ -65,7 +65,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
}
float CPDF_ApSettings::GetOriginalColor(int index,
- const CFX_ByteString& csEntry) const {
+ const ByteString& csEntry) const {
if (!m_pDict)
return 0;
@@ -75,7 +75,7 @@ float CPDF_ApSettings::GetOriginalColor(int index,
void CPDF_ApSettings::GetOriginalColor(int& iColorType,
float fc[4],
- const CFX_ByteString& csEntry) const {
+ const ByteString& csEntry) const {
iColorType = COLORTYPE_TRANSPARENT;
for (int i = 0; i < 4; i++)
fc[i] = 0;
@@ -105,12 +105,11 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType,
}
}
-CFX_WideString CPDF_ApSettings::GetCaption(
- const CFX_ByteString& csEntry) const {
- return m_pDict ? m_pDict->GetUnicodeTextFor(csEntry) : CFX_WideString();
+WideString CPDF_ApSettings::GetCaption(const ByteString& csEntry) const {
+ return m_pDict ? m_pDict->GetUnicodeTextFor(csEntry) : WideString();
}
-CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteString& csEntry) const {
+CPDF_Stream* CPDF_ApSettings::GetIcon(const ByteString& csEntry) const {
return m_pDict ? m_pDict->GetStreamFor(csEntry) : nullptr;
}
diff --git a/core/fpdfdoc/cpdf_apsettings.h b/core/fpdfdoc/cpdf_apsettings.h
index 2f8f9e49d9..a2a1f91a33 100644
--- a/core/fpdfdoc/cpdf_apsettings.h
+++ b/core/fpdfdoc/cpdf_apsettings.h
@@ -23,7 +23,7 @@ class CPDF_ApSettings {
CPDF_ApSettings(const CPDF_ApSettings& that);
~CPDF_ApSettings();
- bool HasMKEntry(const CFX_ByteString& csEntry) const;
+ bool HasMKEntry(const ByteString& csEntry) const;
int GetRotation() const;
FX_ARGB GetBorderColor(int& iColorType) const {
@@ -50,9 +50,9 @@ class CPDF_ApSettings {
GetOriginalColor(iColorType, fc, "BG");
}
- CFX_WideString GetNormalCaption() const { return GetCaption("CA"); }
- CFX_WideString GetRolloverCaption() const { return GetCaption("RC"); }
- CFX_WideString GetDownCaption() const { return GetCaption("AC"); }
+ WideString GetNormalCaption() const { return GetCaption("CA"); }
+ WideString GetRolloverCaption() const { return GetCaption("RC"); }
+ WideString GetDownCaption() const { return GetCaption("AC"); }
CPDF_Stream* GetNormalIcon() const { return GetIcon("I"); }
CPDF_Stream* GetRolloverIcon() const { return GetIcon("RI"); }
CPDF_Stream* GetDownIcon() const { return GetIcon("IX"); }
@@ -62,14 +62,14 @@ class CPDF_ApSettings {
private:
friend class CPDF_FormControl;
- FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry) const;
- float GetOriginalColor(int index, const CFX_ByteString& csEntry) const;
+ FX_ARGB GetColor(int& iColorType, const ByteString& csEntry) const;
+ float GetOriginalColor(int index, const ByteString& csEntry) const;
void GetOriginalColor(int& iColorType,
float fc[4],
- const CFX_ByteString& csEntry) const;
+ const ByteString& csEntry) const;
- CFX_WideString GetCaption(const CFX_ByteString& csEntry) const;
- CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const;
+ WideString GetCaption(const ByteString& csEntry) const;
+ CPDF_Stream* GetIcon(const ByteString& csEntry) const;
CFX_UnownedPtr<CPDF_Dictionary> const m_pDict;
};
diff --git a/core/fpdfdoc/cpdf_bookmark.cpp b/core/fpdfdoc/cpdf_bookmark.cpp
index e84001f846..884c3cb0b8 100644
--- a/core/fpdfdoc/cpdf_bookmark.cpp
+++ b/core/fpdfdoc/cpdf_bookmark.cpp
@@ -40,25 +40,25 @@ uint32_t CPDF_Bookmark::GetFontStyle() const {
return m_pDict ? m_pDict->GetIntegerFor("F") : 0;
}
-CFX_WideString CPDF_Bookmark::GetTitle() const {
+WideString CPDF_Bookmark::GetTitle() const {
if (!m_pDict)
- return CFX_WideString();
+ return WideString();
CPDF_String* pString = ToString(m_pDict->GetDirectObjectFor("Title"));
if (!pString)
- return CFX_WideString();
+ return WideString();
- CFX_WideString title = pString->GetUnicodeText();
+ WideString title = pString->GetUnicodeText();
int len = title.GetLength();
if (!len)
- return CFX_WideString();
+ return WideString();
std::vector<wchar_t> buf(len);
for (int i = 0; i < len; i++) {
wchar_t w = title[i];
buf[i] = w > 0x20 ? w : 0x20;
}
- return CFX_WideString(buf.data(), len);
+ return WideString(buf.data(), len);
}
CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const {
diff --git a/core/fpdfdoc/cpdf_bookmark.h b/core/fpdfdoc/cpdf_bookmark.h
index b9a1ac650e..88f47a9450 100644
--- a/core/fpdfdoc/cpdf_bookmark.h
+++ b/core/fpdfdoc/cpdf_bookmark.h
@@ -25,7 +25,7 @@ class CPDF_Bookmark {
CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
uint32_t GetColorRef() const;
uint32_t GetFontStyle() const;
- CFX_WideString GetTitle() const;
+ WideString GetTitle() const;
CPDF_Dest GetDest(CPDF_Document* pDocument) const;
CPDF_Action GetAction() const;
diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp
index 28213aa33b..bd7ea1bc07 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.cpp
+++ b/core/fpdfdoc/cpdf_defaultappearance.cpp
@@ -16,16 +16,16 @@ bool CPDF_DefaultAppearance::HasFont() {
if (m_csDA.IsEmpty())
return false;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
return syntax.FindTagParamFromStart("Tf", 2);
}
-CFX_ByteString CPDF_DefaultAppearance::GetFontString() {
- CFX_ByteString csFont;
+ByteString CPDF_DefaultAppearance::GetFontString() {
+ ByteString csFont;
if (m_csDA.IsEmpty())
return csFont;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart("Tf", 2)) {
csFont += syntax.GetWord();
csFont += " ";
@@ -36,15 +36,15 @@ CFX_ByteString CPDF_DefaultAppearance::GetFontString() {
return csFont;
}
-CFX_ByteString CPDF_DefaultAppearance::GetFont(float* fFontSize) {
+ByteString CPDF_DefaultAppearance::GetFont(float* fFontSize) {
*fFontSize = 0.0f;
if (m_csDA.IsEmpty())
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString csFontNameTag;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ ByteString csFontNameTag;
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart("Tf", 2)) {
- csFontNameTag = CFX_ByteString(syntax.GetWord());
+ csFontNameTag = ByteString(syntax.GetWord());
csFontNameTag.Delete(0, 1);
*fFontSize = FX_atof(syntax.GetWord());
}
@@ -55,7 +55,7 @@ bool CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) {
if (m_csDA.IsEmpty())
return false;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
return true;
@@ -68,13 +68,12 @@ bool CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) {
(nOperation == PaintOperation::STROKE ? "K" : "k"), 4);
}
-CFX_ByteString CPDF_DefaultAppearance::GetColorString(
- PaintOperation nOperation) {
- CFX_ByteString csColor;
+ByteString CPDF_DefaultAppearance::GetColorString(PaintOperation nOperation) {
+ ByteString csColor;
if (m_csDA.IsEmpty())
return csColor;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
csColor += syntax.GetWord();
@@ -118,7 +117,7 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType,
if (m_csDA.IsEmpty())
return;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
iColorType = COLORTYPE_GRAY;
@@ -151,7 +150,7 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color,
if (m_csDA.IsEmpty())
return;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart(
(nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) {
iColorType = COLORTYPE_GRAY;
@@ -187,16 +186,16 @@ bool CPDF_DefaultAppearance::HasTextMatrix() {
if (m_csDA.IsEmpty())
return false;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
return syntax.FindTagParamFromStart("Tm", 6);
}
-CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() {
- CFX_ByteString csTM;
+ByteString CPDF_DefaultAppearance::GetTextMatrixString() {
+ ByteString csTM;
if (m_csDA.IsEmpty())
return csTM;
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (syntax.FindTagParamFromStart("Tm", 6)) {
for (int i = 0; i < 6; i++) {
csTM += syntax.GetWord();
@@ -211,7 +210,7 @@ CFX_Matrix CPDF_DefaultAppearance::GetTextMatrix() {
if (m_csDA.IsEmpty())
return CFX_Matrix();
- CPDF_SimpleParser syntax(m_csDA.AsStringC());
+ CPDF_SimpleParser syntax(m_csDA.AsStringView());
if (!syntax.FindTagParamFromStart("Tm", 6))
return CFX_Matrix();
diff --git a/core/fpdfdoc/cpdf_defaultappearance.h b/core/fpdfdoc/cpdf_defaultappearance.h
index 3be06e294d..33d4bfdd9d 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.h
+++ b/core/fpdfdoc/cpdf_defaultappearance.h
@@ -19,21 +19,20 @@ enum class PaintOperation { STROKE, FILL };
class CPDF_DefaultAppearance {
public:
CPDF_DefaultAppearance() {}
- explicit CPDF_DefaultAppearance(const CFX_ByteString& csDA) : m_csDA(csDA) {}
+ explicit CPDF_DefaultAppearance(const ByteString& csDA) : m_csDA(csDA) {}
CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) {
m_csDA = cDA.GetStr();
}
- CFX_ByteString GetStr() const { return m_csDA; }
+ ByteString GetStr() const { return m_csDA; }
bool HasFont();
- CFX_ByteString GetFontString();
- CFX_ByteString GetFont(float* fFontSize);
+ ByteString GetFontString();
+ ByteString GetFont(float* fFontSize);
bool HasColor(PaintOperation nOperation = PaintOperation::FILL);
- CFX_ByteString GetColorString(
- PaintOperation nOperation = PaintOperation::FILL);
+ ByteString GetColorString(PaintOperation nOperation = PaintOperation::FILL);
void GetColor(int& iColorType,
float fc[4],
PaintOperation nOperation = PaintOperation::FILL);
@@ -42,11 +41,11 @@ class CPDF_DefaultAppearance {
PaintOperation nOperation = PaintOperation::FILL);
bool HasTextMatrix();
- CFX_ByteString GetTextMatrixString();
+ ByteString GetTextMatrixString();
CFX_Matrix GetTextMatrix();
private:
- CFX_ByteString m_csDA;
+ ByteString m_csDA;
};
#endif // CORE_FPDFDOC_CPDF_DEFAULTAPPEARANCE_H_
diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp
index 3e1988dd5e..ebe3834e91 100644
--- a/core/fpdfdoc/cpdf_dest.cpp
+++ b/core/fpdfdoc/cpdf_dest.cpp
@@ -65,7 +65,7 @@ int CPDF_Dest::GetZoomMode() {
if (!pObj)
return 0;
- CFX_ByteString mode = pObj->GetString();
+ ByteString mode = pObj->GetString();
for (int i = 0; g_sZoomModes[i]; ++i) {
if (mode == g_sZoomModes[i])
return i + 1;
@@ -126,6 +126,6 @@ float CPDF_Dest::GetParam(int index) {
return pArray ? pArray->GetNumberAt(2 + index) : 0;
}
-CFX_ByteString CPDF_Dest::GetRemoteName() {
- return m_pObj ? m_pObj->GetString() : CFX_ByteString();
+ByteString CPDF_Dest::GetRemoteName() {
+ return m_pObj ? m_pObj->GetString() : ByteString();
}
diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h
index f029d4c031..23964d7400 100644
--- a/core/fpdfdoc/cpdf_dest.h
+++ b/core/fpdfdoc/cpdf_dest.h
@@ -22,7 +22,7 @@ class CPDF_Dest {
~CPDF_Dest();
CPDF_Object* GetObject() const { return m_pObj.Get(); }
- CFX_ByteString GetRemoteName();
+ ByteString GetRemoteName();
int GetPageIndex(CPDF_Document* pDoc);
uint32_t GetPageObjNum();
int GetZoomMode();
diff --git a/core/fpdfdoc/cpdf_docjsactions.cpp b/core/fpdfdoc/cpdf_docjsactions.cpp
index 669ed7055c..974ca33b8b 100644
--- a/core/fpdfdoc/cpdf_docjsactions.cpp
+++ b/core/fpdfdoc/cpdf_docjsactions.cpp
@@ -18,9 +18,8 @@ int CPDF_DocJSActions::CountJSActions() const {
return name_tree.GetCount();
}
-CPDF_Action CPDF_DocJSActions::GetJSActionAndName(
- int index,
- CFX_WideString* csName) const {
+CPDF_Action CPDF_DocJSActions::GetJSActionAndName(int index,
+ WideString* csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
CPDF_Object* pAction = name_tree.LookupValueAndName(index, csName);
@@ -28,7 +27,7 @@ CPDF_Action CPDF_DocJSActions::GetJSActionAndName(
: CPDF_Action();
}
-CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_WideString& csName) const {
+CPDF_Action CPDF_DocJSActions::GetJSAction(const WideString& csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(csName);
@@ -36,7 +35,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_WideString& csName) const {
: CPDF_Action();
}
-int CPDF_DocJSActions::FindJSAction(const CFX_WideString& csName) const {
+int CPDF_DocJSActions::FindJSAction(const WideString& csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
return name_tree.GetIndex(csName);
diff --git a/core/fpdfdoc/cpdf_docjsactions.h b/core/fpdfdoc/cpdf_docjsactions.h
index 73c0a1ef1c..c2652d7f6d 100644
--- a/core/fpdfdoc/cpdf_docjsactions.h
+++ b/core/fpdfdoc/cpdf_docjsactions.h
@@ -19,9 +19,9 @@ class CPDF_DocJSActions {
~CPDF_DocJSActions();
int CountJSActions() const;
- CPDF_Action GetJSActionAndName(int index, CFX_WideString* csName) const;
- CPDF_Action GetJSAction(const CFX_WideString& csName) const;
- int FindJSAction(const CFX_WideString& csName) const;
+ CPDF_Action GetJSActionAndName(int index, WideString* csName) const;
+ CPDF_Action GetJSAction(const WideString& csName) const;
+ int FindJSAction(const WideString& csName) const;
CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
private:
diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp
index e34f54e4e1..803c4148c7 100644
--- a/core/fpdfdoc/cpdf_filespec.cpp
+++ b/core/fpdfdoc/cpdf_filespec.cpp
@@ -20,8 +20,8 @@ namespace {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-CFX_WideString ChangeSlashToPlatform(const wchar_t* str) {
- CFX_WideString result;
+WideString ChangeSlashToPlatform(const wchar_t* str) {
+ WideString result;
while (*str) {
if (*str == '/') {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -37,8 +37,8 @@ CFX_WideString ChangeSlashToPlatform(const wchar_t* str) {
return result;
}
-CFX_WideString ChangeSlashToPDF(const wchar_t* str) {
- CFX_WideString result;
+WideString ChangeSlashToPDF(const wchar_t* str) {
+ WideString result;
while (*str) {
if (*str == '\\' || *str == ':')
result += L'/';
@@ -59,12 +59,12 @@ CPDF_FileSpec::CPDF_FileSpec(CPDF_Object* pObj) : m_pObj(pObj) {
CPDF_FileSpec::~CPDF_FileSpec() {}
-CFX_WideString CPDF_FileSpec::DecodeFileName(const CFX_WideString& filepath) {
+WideString CPDF_FileSpec::DecodeFileName(const WideString& filepath) {
if (filepath.GetLength() <= 1)
- return CFX_WideString();
+ return WideString();
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if (filepath.Left(sizeof("/Mac") - 1) == CFX_WideStringC(L"/Mac"))
+ if (filepath.Left(sizeof("/Mac") - 1) == WideStringView(L"/Mac"))
return ChangeSlashToPlatform(filepath.c_str() + 1);
return ChangeSlashToPlatform(filepath.c_str());
#elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
@@ -74,28 +74,28 @@ CFX_WideString CPDF_FileSpec::DecodeFileName(const CFX_WideString& filepath) {
if (filepath[1] == L'/')
return ChangeSlashToPlatform(filepath.c_str() + 1);
if (filepath[2] == L'/') {
- CFX_WideString result;
+ WideString result;
result += filepath[1];
result += L':';
result += ChangeSlashToPlatform(filepath.c_str() + 2);
return result;
}
- CFX_WideString result;
+ WideString result;
result += L'\\';
result += ChangeSlashToPlatform(filepath.c_str());
return result;
#else
- return CFX_WideString(filepath);
+ return WideString(filepath);
#endif
}
-CFX_WideString CPDF_FileSpec::GetFileName() const {
- CFX_WideString csFileName;
+WideString CPDF_FileSpec::GetFileName() const {
+ WideString csFileName;
if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
csFileName = pDict->GetUnicodeTextFor("UF");
if (csFileName.IsEmpty()) {
csFileName =
- CFX_WideString::FromLocal(pDict->GetStringFor("F").AsStringC());
+ WideString::FromLocal(pDict->GetStringFor("F").AsStringView());
}
if (pDict->GetStringFor("FS") == "URL")
return csFileName;
@@ -105,13 +105,13 @@ CFX_WideString CPDF_FileSpec::GetFileName() const {
for (const auto* key : keys) {
if (pDict->KeyExist(key)) {
csFileName =
- CFX_WideString::FromLocal(pDict->GetStringFor(key).AsStringC());
+ WideString::FromLocal(pDict->GetStringFor(key).AsStringView());
break;
}
}
}
} else if (m_pObj->IsString()) {
- csFileName = CFX_WideString::FromLocal(m_pObj->GetString().AsStringC());
+ csFileName = WideString::FromLocal(m_pObj->GetString().AsStringView());
}
return DecodeFileName(csFileName);
}
@@ -131,7 +131,7 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const {
constexpr const char* keys[] = {"UF", "F", "DOS", "Mac", "Unix"};
size_t end = pDict->GetStringFor("FS") == "URL" ? 2 : FX_ArraySize(keys);
for (size_t i = 0; i < end; ++i) {
- const CFX_ByteString& key = keys[i];
+ const ByteString& key = keys[i];
if (!pDict->GetUnicodeTextFor(key).IsEmpty()) {
CPDF_Stream* pStream = pFiles->GetStreamFor(key);
if (pStream)
@@ -153,13 +153,13 @@ CPDF_Dictionary* CPDF_FileSpec::GetParamsDict() const {
return pDict->GetDictFor("Params");
}
-CFX_WideString CPDF_FileSpec::EncodeFileName(const CFX_WideString& filepath) {
+WideString CPDF_FileSpec::EncodeFileName(const WideString& filepath) {
if (filepath.GetLength() <= 1)
- return CFX_WideString();
+ return WideString();
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
if (filepath[1] == L':') {
- CFX_WideString result(L'/');
+ WideString result(L'/');
result += filepath[0];
if (filepath[2] != L'\\')
result += L'/';
@@ -178,17 +178,16 @@ CFX_WideString CPDF_FileSpec::EncodeFileName(const CFX_WideString& filepath) {
return L'/' + ChangeSlashToPDF(filepath.c_str());
return ChangeSlashToPDF(filepath.c_str());
#else
- return CFX_WideString(filepath);
+ return WideString(filepath);
#endif
}
-void CPDF_FileSpec::SetFileName(const CFX_WideString& wsFileName) {
- CFX_WideString wsStr = EncodeFileName(wsFileName);
+void CPDF_FileSpec::SetFileName(const WideString& wsFileName) {
+ WideString wsStr = EncodeFileName(wsFileName);
if (m_pObj->IsString()) {
- m_pObj->SetString(CFX_ByteString::FromUnicode(wsStr));
+ m_pObj->SetString(ByteString::FromUnicode(wsStr));
} else if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
- pDict->SetNewFor<CPDF_String>("F", CFX_ByteString::FromUnicode(wsStr),
- false);
+ pDict->SetNewFor<CPDF_String>("F", ByteString::FromUnicode(wsStr), false);
pDict->SetNewFor<CPDF_String>("UF", PDF_EncodeText(wsStr), false);
}
}
diff --git a/core/fpdfdoc/cpdf_filespec.h b/core/fpdfdoc/cpdf_filespec.h
index 8640b2e4c6..2cbbc15977 100644
--- a/core/fpdfdoc/cpdf_filespec.h
+++ b/core/fpdfdoc/cpdf_filespec.h
@@ -22,18 +22,18 @@ class CPDF_FileSpec {
~CPDF_FileSpec();
// Convert a platform dependent file name into pdf format.
- static CFX_WideString EncodeFileName(const CFX_WideString& filepath);
+ static WideString EncodeFileName(const WideString& filepath);
// Convert a pdf file name into platform dependent format.
- static CFX_WideString DecodeFileName(const CFX_WideString& filepath);
+ static WideString DecodeFileName(const WideString& filepath);
CPDF_Object* GetObj() const { return m_pObj.Get(); }
- CFX_WideString GetFileName() const;
+ WideString GetFileName() const;
CPDF_Stream* GetFileStream() const;
CPDF_Dictionary* GetParamsDict() const;
// Set this file spec to refer to a file name (not a url).
- void SetFileName(const CFX_WideString& wsFileName);
+ void SetFileName(const WideString& wsFileName);
private:
CFX_UnownedPtr<CPDF_Object> const m_pObj;
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 555d19660f..62302fe499 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -34,10 +34,10 @@ CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField,
CPDF_FormControl::~CPDF_FormControl() {}
-CFX_ByteString CPDF_FormControl::GetOnStateName() const {
+ByteString CPDF_FormControl::GetOnStateName() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn;
+ ByteString csOn;
CPDF_Dictionary* pAP = m_pWidgetDict->GetDictFor("AP");
if (!pAP)
return csOn;
@@ -50,19 +50,19 @@ CFX_ByteString CPDF_FormControl::GetOnStateName() const {
if (it.first != "Off")
return it.first;
}
- return CFX_ByteString();
+ return ByteString();
}
-void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
+void CPDF_FormControl::SetOnStateName(const ByteString& csOn) {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csValue = csOn;
+ ByteString csValue = csOn;
if (csValue.IsEmpty())
csValue = "Yes";
else if (csValue == "Off")
csValue = "Yes";
- CFX_ByteString csAS = m_pWidgetDict->GetStringFor("AS", "Off");
+ ByteString csAS = m_pWidgetDict->GetStringFor("AS", "Off");
if (csAS != "Off")
m_pWidgetDict->SetNewFor<CPDF_Name>("AS", csValue);
@@ -82,7 +82,7 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
auto subdict_it = pSubDict->begin();
while (subdict_it != pSubDict->end()) {
- const CFX_ByteString& csKey2 = subdict_it->first;
+ const ByteString& csKey2 = subdict_it->first;
CPDF_Object* pObj2 = subdict_it->second.get();
++subdict_it;
if (!pObj2)
@@ -95,10 +95,10 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
}
}
-CFX_ByteString CPDF_FormControl::GetCheckedAPState() {
+ByteString CPDF_FormControl::GetCheckedAPState() {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn = GetOnStateName();
+ ByteString csOn = GetOnStateName();
if (GetType() == CPDF_FormField::RadioButton ||
GetType() == CPDF_FormField::CheckBox) {
if (ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt"))) {
@@ -111,10 +111,10 @@ CFX_ByteString CPDF_FormControl::GetCheckedAPState() {
return csOn;
}
-CFX_WideString CPDF_FormControl::GetExportValue() const {
+WideString CPDF_FormControl::GetExportValue() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn = GetOnStateName();
+ ByteString csOn = GetOnStateName();
if (GetType() == CPDF_FormField::RadioButton ||
GetType() == CPDF_FormField::CheckBox) {
if (CPDF_Array* pArray =
@@ -131,8 +131,8 @@ CFX_WideString CPDF_FormControl::GetExportValue() const {
bool CPDF_FormControl::IsChecked() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn = GetOnStateName();
- CFX_ByteString csAS = m_pWidgetDict->GetStringFor("AS");
+ ByteString csOn = GetOnStateName();
+ ByteString csAS = m_pWidgetDict->GetStringFor("AS");
return csAS == csOn;
}
@@ -143,17 +143,17 @@ bool CPDF_FormControl::IsDefaultChecked() const {
if (!pDV)
return false;
- CFX_ByteString csDV = pDV->GetString();
- CFX_ByteString csOn = GetOnStateName();
+ ByteString csDV = pDV->GetString();
+ ByteString csOn = GetOnStateName();
return (csDV == csOn);
}
void CPDF_FormControl::CheckControl(bool bChecked) {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
- CFX_ByteString csOn = GetOnStateName();
- CFX_ByteString csOldAS = m_pWidgetDict->GetStringFor("AS", "Off");
- CFX_ByteString csAS = "Off";
+ ByteString csOn = GetOnStateName();
+ ByteString csOldAS = m_pWidgetDict->GetStringFor("AS", "Off");
+ ByteString csAS = "Off";
if (bChecked)
csAS = csOn;
if (csOldAS == csAS)
@@ -192,7 +192,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() {
if (!m_pWidgetDict)
return Invert;
- CFX_ByteString csH = m_pWidgetDict->GetStringFor("H", "I");
+ ByteString csH = m_pWidgetDict->GetStringFor("H", "I");
for (size_t i = 0; i < FX_ArraySize(g_sHighlightingMode); ++i) {
if (csH == g_sHighlightingMode[i])
return static_cast<HighlightingMode>(i);
@@ -205,7 +205,7 @@ CPDF_ApSettings CPDF_FormControl::GetMK() const {
: nullptr);
}
-bool CPDF_FormControl::HasMKEntry(const CFX_ByteString& csEntry) const {
+bool CPDF_FormControl::HasMKEntry(const ByteString& csEntry) const {
return GetMK().HasMKEntry(csEntry);
}
@@ -213,27 +213,25 @@ int CPDF_FormControl::GetRotation() {
return GetMK().GetRotation();
}
-FX_ARGB CPDF_FormControl::GetColor(int& iColorType,
- const CFX_ByteString& csEntry) {
+FX_ARGB CPDF_FormControl::GetColor(int& iColorType, const ByteString& csEntry) {
return GetMK().GetColor(iColorType, csEntry);
}
-float CPDF_FormControl::GetOriginalColor(int index,
- const CFX_ByteString& csEntry) {
+float CPDF_FormControl::GetOriginalColor(int index, const ByteString& csEntry) {
return GetMK().GetOriginalColor(index, csEntry);
}
void CPDF_FormControl::GetOriginalColor(int& iColorType,
float fc[4],
- const CFX_ByteString& csEntry) {
+ const ByteString& csEntry) {
GetMK().GetOriginalColor(iColorType, fc, csEntry);
}
-CFX_WideString CPDF_FormControl::GetCaption(const CFX_ByteString& csEntry) {
+WideString CPDF_FormControl::GetCaption(const ByteString& csEntry) {
return GetMK().GetCaption(csEntry);
}
-CPDF_Stream* CPDF_FormControl::GetIcon(const CFX_ByteString& csEntry) {
+CPDF_Stream* CPDF_FormControl::GetIcon(const ByteString& csEntry) {
return GetMK().GetIcon(csEntry);
}
@@ -284,7 +282,7 @@ CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance() {
CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
float fFontSize;
CPDF_DefaultAppearance cDA = GetDefaultAppearance();
- CFX_ByteString csFontNameTag = cDA.GetFont(&fFontSize);
+ ByteString csFontNameTag = cDA.GetFont(&fFontSize);
if (csFontNameTag.IsEmpty())
return nullptr;
diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h
index eb63b5b6f0..4f686f44ab 100644
--- a/core/fpdfdoc/cpdf_formcontrol.h
+++ b/core/fpdfdoc/cpdf_formcontrol.h
@@ -61,14 +61,14 @@ class CPDF_FormControl {
CPDF_Annot::AppearanceMode mode,
const CPDF_RenderOptions* pOptions = nullptr);
- CFX_ByteString GetCheckedAPState();
- CFX_WideString GetExportValue() const;
+ ByteString GetCheckedAPState();
+ WideString GetExportValue() const;
bool IsChecked() const;
bool IsDefaultChecked() const;
HighlightingMode GetHighlightingMode();
- bool HasMKEntry(const CFX_ByteString& csEntry) const;
+ bool HasMKEntry(const ByteString& csEntry) const;
int GetRotation();
FX_ARGB GetBorderColor(int& iColorType) { return GetColor(iColorType, "BC"); }
@@ -93,9 +93,9 @@ class CPDF_FormControl {
GetOriginalColor(iColorType, fc, "BG");
}
- CFX_WideString GetNormalCaption() { return GetCaption("CA"); }
- CFX_WideString GetRolloverCaption() { return GetCaption("RC"); }
- CFX_WideString GetDownCaption() { return GetCaption("AC"); }
+ WideString GetNormalCaption() { return GetCaption("CA"); }
+ WideString GetRolloverCaption() { return GetCaption("RC"); }
+ WideString GetDownCaption() { return GetCaption("AC"); }
CPDF_Stream* GetNormalIcon() { return GetIcon("I"); }
CPDF_Stream* GetRolloverIcon() { return GetIcon("RI"); }
@@ -114,17 +114,17 @@ class CPDF_FormControl {
friend class CPDF_InterForm;
friend class CPDF_FormField;
- CFX_ByteString GetOnStateName() const;
- void SetOnStateName(const CFX_ByteString& csOn);
+ ByteString GetOnStateName() const;
+ void SetOnStateName(const ByteString& csOn);
void CheckControl(bool bChecked);
- FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry);
- float GetOriginalColor(int index, const CFX_ByteString& csEntry);
+ FX_ARGB GetColor(int& iColorType, const ByteString& csEntry);
+ float GetOriginalColor(int index, const ByteString& csEntry);
void GetOriginalColor(int& iColorType,
float fc[4],
- const CFX_ByteString& csEntry);
+ const ByteString& csEntry);
- CFX_WideString GetCaption(const CFX_ByteString& csEntry);
- CPDF_Stream* GetIcon(const CFX_ByteString& csEntry);
+ WideString GetCaption(const ByteString& csEntry);
+ CPDF_Stream* GetIcon(const ByteString& csEntry);
CPDF_ApSettings GetMK() const;
CPDF_FormField* const m_pField;
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index acb46a5beb..fec1945956 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -65,13 +65,13 @@ CPDF_Object* FPDF_GetFieldAttr(const CPDF_Dictionary* pFieldDict,
return FPDF_GetFieldAttr(pParent, name, nLevel + 1);
}
-CFX_WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict) {
- CFX_WideString full_name;
+WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict) {
+ WideString full_name;
std::set<CPDF_Dictionary*> visited;
CPDF_Dictionary* pLevel = pFieldDict;
while (pLevel) {
visited.insert(pLevel);
- CFX_WideString short_name = pLevel->GetUnicodeTextFor("T");
+ WideString short_name = pLevel->GetUnicodeTextFor("T");
if (!short_name.IsEmpty()) {
if (full_name.IsEmpty())
full_name = short_name;
@@ -98,7 +98,7 @@ CPDF_FormField::~CPDF_FormField() {}
void CPDF_FormField::SyncFieldFlags() {
CPDF_Object* ft_attr = FPDF_GetFieldAttr(m_pDict.Get(), "FT");
- CFX_ByteString type_name = ft_attr ? ft_attr->GetString() : CFX_ByteString();
+ ByteString type_name = ft_attr ? ft_attr->GetString() : ByteString();
CPDF_Object* ff_attr = FPDF_GetFieldAttr(m_pDict.Get(), "Ff");
uint32_t flags = ff_attr ? ff_attr->GetInteger() : 0;
m_Flags = 0;
@@ -154,7 +154,7 @@ void CPDF_FormField::SyncFieldFlags() {
}
}
-CFX_WideString CPDF_FormField::GetFullName() const {
+WideString CPDF_FormField::GetFullName() const {
return FPDF_GetFullName(m_pDict.Get());
}
@@ -180,7 +180,7 @@ bool CPDF_FormField::ResetField(bool bNotify) {
}
case CPDF_FormField::ComboBox:
case CPDF_FormField::ListBox: {
- CFX_WideString csValue;
+ WideString csValue;
ClearSelection();
int iIndex = GetDefaultSelectedItem();
if (iIndex >= 0)
@@ -199,12 +199,12 @@ bool CPDF_FormField::ResetField(bool bNotify) {
case CPDF_FormField::File:
default: {
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pDict.Get(), "DV");
- CFX_WideString csDValue;
+ WideString csDValue;
if (pDV)
csDValue = pDV->GetUnicodeText();
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict.Get(), "V");
- CFX_WideString csValue;
+ WideString csValue;
if (pV)
csValue = pV->GetUnicodeText();
@@ -272,12 +272,12 @@ CPDF_AAction CPDF_FormField::GetAdditionalAction() const {
return CPDF_AAction(pObj ? pObj->GetDict() : nullptr);
}
-CFX_WideString CPDF_FormField::GetAlternateName() const {
+WideString CPDF_FormField::GetAlternateName() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "TU");
return pObj ? pObj->GetUnicodeText() : L"";
}
-CFX_WideString CPDF_FormField::GetMappingName() const {
+WideString CPDF_FormField::GetMappingName() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "TM");
return pObj ? pObj->GetUnicodeText() : L"";
}
@@ -287,17 +287,17 @@ uint32_t CPDF_FormField::GetFieldFlags() const {
return pObj ? pObj->GetInteger() : 0;
}
-CFX_ByteString CPDF_FormField::GetDefaultStyle() const {
+ByteString CPDF_FormField::GetDefaultStyle() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "DS");
return pObj ? pObj->GetString() : "";
}
-CFX_WideString CPDF_FormField::GetRichTextString() const {
+WideString CPDF_FormField::GetRichTextString() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "RV");
return pObj ? pObj->GetUnicodeText() : L"";
}
-CFX_WideString CPDF_FormField::GetValue(bool bDefault) const {
+WideString CPDF_FormField::GetValue(bool bDefault) const {
if (GetType() == CheckBox || GetType() == RadioButton)
return GetCheckValue(bDefault);
@@ -310,7 +310,7 @@ CFX_WideString CPDF_FormField::GetValue(bool bDefault) const {
pValue = FPDF_GetFieldAttr(m_pDict.Get(), "DV");
}
if (!pValue)
- return CFX_WideString();
+ return WideString();
}
switch (pValue->GetType()) {
@@ -325,18 +325,18 @@ CFX_WideString CPDF_FormField::GetValue(bool bDefault) const {
default:
break;
}
- return CFX_WideString();
+ return WideString();
}
-CFX_WideString CPDF_FormField::GetValue() const {
+WideString CPDF_FormField::GetValue() const {
return GetValue(false);
}
-CFX_WideString CPDF_FormField::GetDefaultValue() const {
+WideString CPDF_FormField::GetDefaultValue() const {
return GetValue(true);
}
-bool CPDF_FormField::SetValue(const CFX_WideString& value,
+bool CPDF_FormField::SetValue(const WideString& value,
bool bDefault,
bool bNotify) {
switch (m_Type) {
@@ -349,14 +349,14 @@ bool CPDF_FormField::SetValue(const CFX_WideString& value,
case RichText:
case Text:
case ComboBox: {
- CFX_WideString csValue = value;
+ WideString csValue = value;
if (bNotify && !NotifyBeforeValueChange(csValue))
return false;
- CFX_ByteString key(bDefault ? "DV" : "V");
+ ByteString key(bDefault ? "DV" : "V");
int iIndex = FindOptionValue(csValue);
if (iIndex < 0) {
- CFX_ByteString bsEncodeText = PDF_EncodeText(csValue);
+ ByteString bsEncodeText = PDF_EncodeText(csValue);
m_pDict->SetNewFor<CPDF_String>(key, bsEncodeText, false);
if (m_Type == RichText && !bDefault)
m_pDict->SetNewFor<CPDF_String>("RV", bsEncodeText, false);
@@ -397,7 +397,7 @@ bool CPDF_FormField::SetValue(const CFX_WideString& value,
return true;
}
-bool CPDF_FormField::SetValue(const CFX_WideString& value, bool bNotify) {
+bool CPDF_FormField::SetValue(const WideString& value, bool bNotify) {
return SetValue(value, false, bNotify);
}
@@ -440,7 +440,7 @@ int CPDF_FormField::GetSelectedIndex(int index) const {
if (pValue->IsNumber())
return pValue->GetInteger();
- CFX_WideString sel_value;
+ WideString sel_value;
if (pValue->IsString()) {
if (index != 0)
return -1;
@@ -451,12 +451,11 @@ int CPDF_FormField::GetSelectedIndex(int index) const {
return -1;
CPDF_Object* elementValue = pArray->GetDirectObjectAt(index);
- sel_value =
- elementValue ? elementValue->GetUnicodeText() : CFX_WideString();
+ sel_value = elementValue ? elementValue->GetUnicodeText() : WideString();
}
if (index < CountSelectedOptions()) {
int iOptIndex = GetSelectedOptionIndex(index);
- CFX_WideString csOpt = GetOptionValue(iOptIndex);
+ WideString csOpt = GetOptionValue(iOptIndex);
if (csOpt == sel_value)
return iOptIndex;
}
@@ -469,7 +468,7 @@ int CPDF_FormField::GetSelectedIndex(int index) const {
bool CPDF_FormField::ClearSelection(bool bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue;
+ WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
@@ -491,7 +490,7 @@ bool CPDF_FormField::IsItemSelected(int index) const {
if (IsOptionSelected(index))
return true;
- CFX_WideString opt_value = GetOptionValue(index);
+ WideString opt_value = GetOptionValue(index);
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict.Get(), "V");
if (!pValue) {
pValue = FPDF_GetFieldAttr(m_pDict.Get(), "I");
@@ -532,7 +531,7 @@ bool CPDF_FormField::SetItemSelection(int index, bool bSelected, bool bNotify) {
if (index < 0 || index >= CountOptions())
return false;
- CFX_WideString opt_value = GetOptionValue(index);
+ WideString opt_value = GetOptionValue(index);
if (bNotify && !NotifyListOrComboBoxBeforeChange(opt_value))
return false;
@@ -598,7 +597,7 @@ int CPDF_FormField::GetDefaultSelectedItem() const {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict.Get(), "DV");
if (!pValue)
return -1;
- CFX_WideString csDV = pValue->GetUnicodeText();
+ WideString csDV = pValue->GetUnicodeText();
if (csDV.IsEmpty())
return -1;
for (int i = 0; i < CountOptions(); i++) {
@@ -613,30 +612,30 @@ int CPDF_FormField::CountOptions() const {
return pArray ? pArray->GetCount() : 0;
}
-CFX_WideString CPDF_FormField::GetOptionText(int index, int sub_index) const {
+WideString CPDF_FormField::GetOptionText(int index, int sub_index) const {
CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict.Get(), "Opt"));
if (!pArray)
- return CFX_WideString();
+ return WideString();
CPDF_Object* pOption = pArray->GetDirectObjectAt(index);
if (!pOption)
- return CFX_WideString();
+ return WideString();
if (CPDF_Array* pOptionArray = pOption->AsArray())
pOption = pOptionArray->GetDirectObjectAt(sub_index);
CPDF_String* pString = ToString(pOption);
- return pString ? pString->GetUnicodeText() : CFX_WideString();
+ return pString ? pString->GetUnicodeText() : WideString();
}
-CFX_WideString CPDF_FormField::GetOptionLabel(int index) const {
+WideString CPDF_FormField::GetOptionLabel(int index) const {
return GetOptionText(index, 1);
}
-CFX_WideString CPDF_FormField::GetOptionValue(int index) const {
+WideString CPDF_FormField::GetOptionValue(int index) const {
return GetOptionText(index, 0);
}
-int CPDF_FormField::FindOption(CFX_WideString csOptLabel) const {
+int CPDF_FormField::FindOption(WideString csOptLabel) const {
for (int i = 0; i < CountOptions(); i++) {
if (GetOptionValue(i) == csOptLabel)
return i;
@@ -644,7 +643,7 @@ int CPDF_FormField::FindOption(CFX_WideString csOptLabel) const {
return -1;
}
-int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue) const {
+int CPDF_FormField::FindOptionValue(const WideString& csOptValue) const {
for (int i = 0; i < CountOptions(); i++) {
if (GetOptionValue(i) == csOptValue)
return i;
@@ -653,7 +652,7 @@ int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue) const {
}
#ifdef PDF_ENABLE_XFA
-int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
+int CPDF_FormField::InsertOption(WideString csOptLabel,
int index,
bool bNotify) {
if (csOptLabel.IsEmpty())
@@ -662,7 +661,7 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
if (bNotify && !NotifyListOrComboBoxBeforeChange(csOptLabel))
return -1;
- CFX_ByteString csStr = PDF_EncodeText(csOptLabel);
+ ByteString csStr = PDF_EncodeText(csOptLabel);
CPDF_Array* pOpt = ToArray(FPDF_GetFieldAttr(m_pDict.Get(), "Opt"));
if (!pOpt)
pOpt = m_pDict->SetNewFor<CPDF_Array>("Opt");
@@ -682,7 +681,7 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
bool CPDF_FormField::ClearOptions(bool bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue;
+ WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
@@ -713,14 +712,14 @@ bool CPDF_FormField::CheckControl(int iControlIndex,
if (!bChecked && pControl->IsChecked() == bChecked)
return false;
- CFX_WideString csWExport = pControl->GetExportValue();
- CFX_ByteString csBExport = PDF_EncodeText(csWExport);
+ WideString csWExport = pControl->GetExportValue();
+ ByteString csBExport = PDF_EncodeText(csWExport);
int iCount = CountControls();
bool bUnison = IsUnison(this);
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pCtrl = GetControl(i);
if (bUnison) {
- CFX_WideString csEValue = pCtrl->GetExportValue();
+ WideString csEValue = pCtrl->GetExportValue();
if (csEValue == csWExport) {
if (pCtrl->GetOnStateName() == pControl->GetOnStateName())
pCtrl->CheckControl(bChecked);
@@ -742,7 +741,7 @@ bool CPDF_FormField::CheckControl(int iControlIndex,
if (bChecked) {
m_pDict->SetNewFor<CPDF_Name>("V", csBExport);
} else {
- CFX_ByteString csV;
+ ByteString csV;
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict.Get(), "V");
if (pV)
csV = pV->GetString();
@@ -750,7 +749,7 @@ bool CPDF_FormField::CheckControl(int iControlIndex,
m_pDict->SetNewFor<CPDF_Name>("V", "Off");
}
} else if (bChecked) {
- CFX_ByteString csIndex;
+ ByteString csIndex;
csIndex.Format("%d", iControlIndex);
m_pDict->SetNewFor<CPDF_Name>("V", csIndex);
}
@@ -759,9 +758,9 @@ bool CPDF_FormField::CheckControl(int iControlIndex,
return true;
}
-CFX_WideString CPDF_FormField::GetCheckValue(bool bDefault) const {
+WideString CPDF_FormField::GetCheckValue(bool bDefault) const {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
- CFX_WideString csExport = L"Off";
+ WideString csExport = L"Off";
int iCount = CountControls();
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pControl = GetControl(i);
@@ -775,14 +774,14 @@ CFX_WideString CPDF_FormField::GetCheckValue(bool bDefault) const {
return csExport;
}
-bool CPDF_FormField::SetCheckValue(const CFX_WideString& value,
+bool CPDF_FormField::SetCheckValue(const WideString& value,
bool bDefault,
bool bNotify) {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
int iCount = CountControls();
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pControl = GetControl(i);
- CFX_WideString csExport = pControl->GetExportValue();
+ WideString csExport = pControl->GetExportValue();
bool val = csExport == value;
if (!bDefault)
CheckControl(GetControlIndex(pControl), val);
@@ -844,7 +843,7 @@ bool CPDF_FormField::SelectOption(int iOptIndex, bool bSelected, bool bNotify) {
return true;
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue = GetOptionLabel(iOptIndex);
+ WideString csValue = GetOptionLabel(iOptIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
return false;
}
@@ -858,7 +857,7 @@ bool CPDF_FormField::SelectOption(int iOptIndex, bool bSelected, bool bNotify) {
continue;
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue = GetOptionLabel(iOptIndex);
+ WideString csValue = GetOptionLabel(iOptIndex);
if (!NotifyListOrComboBoxBeforeChange(csValue))
return false;
}
@@ -882,7 +881,7 @@ bool CPDF_FormField::SelectOption(int iOptIndex, bool bSelected, bool bNotify) {
bool CPDF_FormField::ClearSelectedOptions(bool bNotify) {
if (bNotify && m_pForm->m_pFormNotify) {
- CFX_WideString csValue;
+ WideString csValue;
int iIndex = GetSelectedIndex(0);
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
@@ -902,7 +901,7 @@ void CPDF_FormField::LoadDA() {
if (!pFormDict)
return;
- CFX_ByteString DA;
+ ByteString DA;
if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict.Get(), "DA"))
DA = pObj->GetString();
@@ -920,9 +919,9 @@ void CPDF_FormField::LoadDA() {
if (!pFont)
return;
- CPDF_SimpleParser syntax(DA.AsStringC());
+ CPDF_SimpleParser syntax(DA.AsStringView());
syntax.FindTagParamFromStart("Tf", 2);
- CFX_ByteString font_name(syntax.GetWord());
+ ByteString font_name(syntax.GetWord());
CPDF_Dictionary* pFontDict = pFont->GetDictFor(font_name);
if (!pFontDict)
return;
@@ -931,7 +930,7 @@ void CPDF_FormField::LoadDA() {
m_FontSize = FX_atof(syntax.GetWord());
}
-bool CPDF_FormField::NotifyBeforeSelectionChange(const CFX_WideString& value) {
+bool CPDF_FormField::NotifyBeforeSelectionChange(const WideString& value) {
if (!m_pForm->m_pFormNotify)
return true;
return m_pForm->m_pFormNotify->BeforeSelectionChange(this, value) >= 0;
@@ -943,7 +942,7 @@ void CPDF_FormField::NotifyAfterSelectionChange() {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
-bool CPDF_FormField::NotifyBeforeValueChange(const CFX_WideString& value) {
+bool CPDF_FormField::NotifyBeforeValueChange(const WideString& value) {
if (!m_pForm->m_pFormNotify)
return true;
return m_pForm->m_pFormNotify->BeforeValueChange(this, value) >= 0;
@@ -955,8 +954,7 @@ void CPDF_FormField::NotifyAfterValueChange() {
m_pForm->m_pFormNotify->AfterValueChange(this);
}
-bool CPDF_FormField::NotifyListOrComboBoxBeforeChange(
- const CFX_WideString& value) {
+bool CPDF_FormField::NotifyListOrComboBoxBeforeChange(const WideString& value) {
switch (GetType()) {
case ListBox:
return NotifyBeforeSelectionChange(value);
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index 417f9d189f..6b4b7253e0 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -40,7 +40,7 @@ class CPDF_String;
CPDF_Object* FPDF_GetFieldAttr(const CPDF_Dictionary* pFieldDict,
const char* name,
int nLevel = 0);
-CFX_WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict);
+WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict);
class CPDF_FormField {
public:
@@ -60,7 +60,7 @@ class CPDF_FormField {
CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict);
~CPDF_FormField();
- CFX_WideString GetFullName() const;
+ WideString GetFullName() const;
Type GetType() const { return m_Type; }
uint32_t GetFlags() const { return m_Flags; }
@@ -82,16 +82,16 @@ class CPDF_FormField {
int GetFieldType() const;
CPDF_AAction GetAdditionalAction() const;
- CFX_WideString GetAlternateName() const;
- CFX_WideString GetMappingName() const;
+ WideString GetAlternateName() const;
+ WideString GetMappingName() const;
uint32_t GetFieldFlags() const;
- CFX_ByteString GetDefaultStyle() const;
- CFX_WideString GetRichTextString() const;
+ ByteString GetDefaultStyle() const;
+ WideString GetRichTextString() const;
- CFX_WideString GetValue() const;
- CFX_WideString GetDefaultValue() const;
- bool SetValue(const CFX_WideString& value, bool bNotify = false);
+ WideString GetValue() const;
+ WideString GetDefaultValue() const;
+ bool SetValue(const WideString& value, bool bNotify = false);
int GetMaxLen() const;
int CountSelectedItems() const;
@@ -106,11 +106,11 @@ class CPDF_FormField {
int GetDefaultSelectedItem() const;
int CountOptions() const;
- CFX_WideString GetOptionLabel(int index) const;
- CFX_WideString GetOptionValue(int index) const;
+ WideString GetOptionLabel(int index) const;
+ WideString GetOptionValue(int index) const;
- int FindOption(CFX_WideString csOptLabel) const;
- int FindOptionValue(const CFX_WideString& csOptValue) const;
+ int FindOption(WideString csOptLabel) const;
+ int FindOptionValue(const WideString& csOptValue) const;
bool CheckControl(int iControlIndex, bool bChecked, bool bNotify = false);
@@ -127,9 +127,7 @@ class CPDF_FormField {
#ifdef PDF_ENABLE_XFA
bool ClearOptions(bool bNotify = false);
- int InsertOption(CFX_WideString csOptLabel,
- int index = -1,
- bool bNotify = false);
+ int InsertOption(WideString csOptLabel, int index = -1, bool bNotify = false);
#endif // PDF_ENABLE_XFA
float GetFontSize() const { return m_FontSize; }
@@ -138,7 +136,7 @@ class CPDF_FormField {
const CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
const CPDF_InterForm* GetForm() const { return m_pForm.Get(); }
- CFX_WideString GetCheckValue(bool bDefault) const;
+ WideString GetCheckValue(bool bDefault) const;
void AddFormControl(CPDF_FormControl* pFormControl) {
m_ControlList.emplace_back(pFormControl);
@@ -149,23 +147,23 @@ class CPDF_FormField {
}
private:
- CFX_WideString GetValue(bool bDefault) const;
- bool SetValue(const CFX_WideString& value, bool bDefault, bool bNotify);
+ WideString GetValue(bool bDefault) const;
+ bool SetValue(const WideString& value, bool bDefault, bool bNotify);
void SyncFieldFlags();
int FindListSel(CPDF_String* str);
- CFX_WideString GetOptionText(int index, int sub_index) const;
+ WideString GetOptionText(int index, int sub_index) const;
void LoadDA();
- bool SetCheckValue(const CFX_WideString& value, bool bDefault, bool bNotify);
+ bool SetCheckValue(const WideString& value, bool bDefault, bool bNotify);
- bool NotifyBeforeSelectionChange(const CFX_WideString& value);
+ bool NotifyBeforeSelectionChange(const WideString& value);
void NotifyAfterSelectionChange();
- bool NotifyBeforeValueChange(const CFX_WideString& value);
+ bool NotifyBeforeValueChange(const WideString& value);
void NotifyAfterValueChange();
- bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value);
+ bool NotifyListOrComboBoxBeforeChange(const WideString& value);
void NotifyListOrComboBoxAfterChange();
CPDF_FormField::Type m_Type;
diff --git a/core/fpdfdoc/cpdf_formfield_unittest.cpp b/core/fpdfdoc/cpdf_formfield_unittest.cpp
index 4aeda84c88..af5d15dab3 100644
--- a/core/fpdfdoc/cpdf_formfield_unittest.cpp
+++ b/core/fpdfdoc/cpdf_formfield_unittest.cpp
@@ -10,7 +10,7 @@
#include "testing/gtest/include/gtest/gtest.h"
TEST(cpdf_formfield, FPDF_GetFullName) {
- CFX_WideString name = FPDF_GetFullName(nullptr);
+ WideString name = FPDF_GetFullName(nullptr);
EXPECT_TRUE(name.IsEmpty());
CPDF_IndirectObjectHolder obj_holder;
diff --git a/core/fpdfdoc/cpdf_iconfit.cpp b/core/fpdfdoc/cpdf_iconfit.cpp
index a28f3bc430..20ed963e92 100644
--- a/core/fpdfdoc/cpdf_iconfit.cpp
+++ b/core/fpdfdoc/cpdf_iconfit.cpp
@@ -20,7 +20,7 @@ CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod() {
if (!m_pDict)
return Always;
- CFX_ByteString csSW = m_pDict->GetStringFor("SW", "A");
+ ByteString csSW = m_pDict->GetStringFor("SW", "A");
if (csSW == "B")
return Bigger;
if (csSW == "S")
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 7e73f7e5a5..3bbb50b9ec 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -40,24 +40,24 @@ const struct SupportFieldEncoding {
{"UHC", 949},
};
-CFX_WideString GetFieldValue(const CPDF_Dictionary& pFieldDict,
- const CFX_ByteString& bsEncoding) {
- const CFX_ByteString csBValue = pFieldDict.GetStringFor("V");
+WideString GetFieldValue(const CPDF_Dictionary& pFieldDict,
+ const ByteString& bsEncoding) {
+ const ByteString csBValue = pFieldDict.GetStringFor("V");
for (const auto& encoding : g_fieldEncoding) {
if (bsEncoding == encoding.m_name)
- return CFX_WideString::FromCodePage(csBValue.AsStringC(),
- encoding.m_codePage);
+ return WideString::FromCodePage(csBValue.AsStringView(),
+ encoding.m_codePage);
}
- CFX_ByteString csTemp = csBValue.Left(2);
+ ByteString csTemp = csBValue.Left(2);
if (csTemp == "\xFF\xFE" || csTemp == "\xFE\xFF")
return PDF_DecodeText(csBValue);
- return CFX_WideString::FromLocal(csBValue.AsStringC());
+ return WideString::FromLocal(csBValue.AsStringView());
}
void AddFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
const CPDF_Font* pFont,
- CFX_ByteString* csNameTag);
+ ByteString* csNameTag);
void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
if (!pDocument)
@@ -69,17 +69,16 @@ void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
pFormDict->GetObjNum());
}
- CFX_ByteString csDA;
+ ByteString csDA;
if (!pFormDict->KeyExist("DR")) {
- CFX_ByteString csBaseName;
+ ByteString csBaseName;
uint8_t charSet = CPDF_InterForm::GetNativeCharSet();
CPDF_Font* pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica");
if (pFont)
AddFont(pFormDict, pDocument, pFont, &csBaseName);
if (charSet != FX_CHARSET_ANSI) {
- CFX_ByteString csFontName =
- CPDF_InterForm::GetNativeFont(charSet, nullptr);
+ ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, nullptr);
if (!pFont || csFontName != "Helvetica") {
pFont = CPDF_InterForm::AddNativeFont(pDocument);
if (pFont) {
@@ -101,8 +100,8 @@ void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
- const CFX_ByteString& csNameTag) {
- CFX_ByteString csAlias = PDF_NameDecode(csNameTag);
+ const ByteString& csNameTag) {
+ ByteString csAlias = PDF_NameDecode(csNameTag);
if (!pFormDict || csAlias.IsEmpty())
return nullptr;
@@ -126,7 +125,7 @@ CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
uint8_t charSet,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFormDict)
return nullptr;
@@ -139,7 +138,7 @@ CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
return nullptr;
for (const auto& it : *pFonts) {
- const CFX_ByteString& csKey = it.first;
+ const ByteString& csKey = it.first;
if (!it.second)
continue;
@@ -166,7 +165,7 @@ CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
bool FindFont(CPDF_Dictionary* pFormDict,
const CPDF_Font* pFont,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFormDict || !pFont)
return false;
@@ -179,7 +178,7 @@ bool FindFont(CPDF_Dictionary* pFormDict,
return false;
for (const auto& it : *pFonts) {
- const CFX_ByteString& csKey = it.first;
+ const ByteString& csKey = it.first;
if (!it.second)
continue;
CPDF_Dictionary* pElement = ToDictionary(it.second->GetDirect());
@@ -197,9 +196,9 @@ bool FindFont(CPDF_Dictionary* pFormDict,
bool FindFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
- CFX_ByteString csFontName,
+ ByteString csFontName,
CPDF_Font*& pFont,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFormDict)
return false;
@@ -215,7 +214,7 @@ bool FindFont(CPDF_Dictionary* pFormDict,
csFontName.Remove(' ');
for (const auto& it : *pFonts) {
- const CFX_ByteString& csKey = it.first;
+ const ByteString& csKey = it.first;
if (!it.second)
continue;
@@ -228,7 +227,7 @@ bool FindFont(CPDF_Dictionary* pFormDict,
if (!pFont)
continue;
- CFX_ByteString csBaseFont;
+ ByteString csBaseFont;
csBaseFont = pFont->GetBaseFont();
csBaseFont.Remove(' ');
if (csBaseFont == csFontName) {
@@ -242,13 +241,13 @@ bool FindFont(CPDF_Dictionary* pFormDict,
void AddFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
const CPDF_Font* pFont,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFont)
return;
if (!pFormDict)
InitDict(pFormDict, pDocument);
- CFX_ByteString csTag;
+ ByteString csTag;
if (FindFont(pFormDict, pFont, &csTag)) {
*csNameTag = csTag;
return;
@@ -277,17 +276,17 @@ void AddFont(CPDF_Dictionary*& pFormDict,
CPDF_Font* AddNativeFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
uint8_t charSet,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
if (!pFormDict)
InitDict(pFormDict, pDocument);
- CFX_ByteString csTemp;
+ ByteString csTemp;
CPDF_Font* pFont = GetNativeFont(pFormDict, pDocument, charSet, &csTemp);
if (pFont) {
*csNameTag = csTemp;
return pFont;
}
- CFX_ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, nullptr);
+ ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, nullptr);
if (!csFontName.IsEmpty() &&
FindFont(pFormDict, pDocument, csFontName, pFont, csNameTag)) {
return pFont;
@@ -301,7 +300,7 @@ CPDF_Font* AddNativeFont(CPDF_Dictionary*& pFormDict,
class CFieldNameExtractor {
public:
- explicit CFieldNameExtractor(const CFX_WideString& full_name)
+ explicit CFieldNameExtractor(const WideString& full_name)
: m_FullName(full_name) {
m_pCur = m_FullName.c_str();
m_pEnd = m_pCur + m_FullName.GetLength();
@@ -318,7 +317,7 @@ class CFieldNameExtractor {
}
protected:
- CFX_WideString m_FullName;
+ WideString m_FullName;
const wchar_t* m_pCur;
const wchar_t* m_pEnd;
};
@@ -371,7 +370,7 @@ bool RetrieveSpecificFont(uint8_t charSet,
}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-int CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2) {
+int CompareFieldName(const WideString& name1, const WideString& name2) {
const wchar_t* ptr1 = name1.c_str();
const wchar_t* ptr2 = name2.c_str();
if (name1.GetLength() == name2.GetLength())
@@ -394,7 +393,7 @@ class CFieldTree {
class Node {
public:
Node() : m_pField(nullptr), m_level(0) {}
- Node(const CFX_WideString& short_name, int level)
+ Node(const WideString& short_name, int level)
: m_ShortName(short_name), m_level(level) {}
~Node() {}
@@ -420,7 +419,7 @@ class CFieldTree {
CPDF_FormField* GetField() const { return m_pField.get(); }
- const CFX_WideString& GetShortName() const { return m_ShortName; }
+ const WideString& GetShortName() const { return m_ShortName; }
int GetLevel() const { return m_level; }
@@ -451,7 +450,7 @@ class CFieldTree {
}
std::vector<std::unique_ptr<Node>> m_Children;
- CFX_WideString m_ShortName;
+ WideString m_ShortName;
std::unique_ptr<CPDF_FormField> m_pField;
const int m_level;
};
@@ -459,14 +458,14 @@ class CFieldTree {
CFieldTree();
~CFieldTree();
- bool SetField(const CFX_WideString& full_name,
+ bool SetField(const WideString& full_name,
std::unique_ptr<CPDF_FormField> pField);
- CPDF_FormField* GetField(const CFX_WideString& full_name);
+ CPDF_FormField* GetField(const WideString& full_name);
- Node* FindNode(const CFX_WideString& full_name);
- Node* AddChild(Node* pParent, const CFX_WideString& short_name);
+ Node* FindNode(const WideString& full_name);
+ Node* AddChild(Node* pParent, const WideString& short_name);
- Node* Lookup(Node* pParent, const CFX_WideString& short_name);
+ Node* Lookup(Node* pParent, const WideString& short_name);
Node m_Root;
};
@@ -476,7 +475,7 @@ CFieldTree::CFieldTree() {}
CFieldTree::~CFieldTree() {}
CFieldTree::Node* CFieldTree::AddChild(Node* pParent,
- const CFX_WideString& short_name) {
+ const WideString& short_name) {
if (!pParent)
return nullptr;
@@ -491,7 +490,7 @@ CFieldTree::Node* CFieldTree::AddChild(Node* pParent,
}
CFieldTree::Node* CFieldTree::Lookup(Node* pParent,
- const CFX_WideString& short_name) {
+ const WideString& short_name) {
if (!pParent)
return nullptr;
@@ -503,7 +502,7 @@ CFieldTree::Node* CFieldTree::Lookup(Node* pParent,
return nullptr;
}
-bool CFieldTree::SetField(const CFX_WideString& full_name,
+bool CFieldTree::SetField(const WideString& full_name,
std::unique_ptr<CPDF_FormField> pField) {
if (full_name.IsEmpty())
return false;
@@ -516,7 +515,7 @@ bool CFieldTree::SetField(const CFX_WideString& full_name,
Node* pLast = nullptr;
while (nLength > 0) {
pLast = pNode;
- CFX_WideString name = CFX_WideString(pName, nLength);
+ WideString name = WideString(pName, nLength);
pNode = Lookup(pLast, name);
if (!pNode)
pNode = AddChild(pLast, name);
@@ -532,7 +531,7 @@ bool CFieldTree::SetField(const CFX_WideString& full_name,
return true;
}
-CPDF_FormField* CFieldTree::GetField(const CFX_WideString& full_name) {
+CPDF_FormField* CFieldTree::GetField(const WideString& full_name) {
if (full_name.IsEmpty())
return nullptr;
@@ -544,14 +543,14 @@ CPDF_FormField* CFieldTree::GetField(const CFX_WideString& full_name) {
Node* pLast = nullptr;
while (nLength > 0 && pNode) {
pLast = pNode;
- CFX_WideString name = CFX_WideString(pName, nLength);
+ WideString name = WideString(pName, nLength);
pNode = Lookup(pLast, name);
name_extractor.GetNext(pName, nLength);
}
return pNode ? pNode->GetField() : nullptr;
}
-CFieldTree::Node* CFieldTree::FindNode(const CFX_WideString& full_name) {
+CFieldTree::Node* CFieldTree::FindNode(const WideString& full_name) {
if (full_name.IsEmpty())
return nullptr;
@@ -563,7 +562,7 @@ CFieldTree::Node* CFieldTree::FindNode(const CFX_WideString& full_name) {
Node* pLast = nullptr;
while (nLength > 0 && pNode) {
pLast = pNode;
- CFX_WideString name = CFX_WideString(pName, nLength);
+ WideString name = WideString(pName, nLength);
pNode = Lookup(pLast, name);
name_extractor.GetNext(pName, nLength);
}
@@ -572,7 +571,7 @@ CFieldTree::Node* CFieldTree::FindNode(const CFX_WideString& full_name) {
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
- CFX_ByteString* csNameTag) {
+ ByteString* csNameTag) {
uint8_t charSet = CPDF_InterForm::GetNativeCharSet();
return AddNativeFont(pFormDict, pDocument, charSet, csNameTag);
}
@@ -671,13 +670,13 @@ void CPDF_InterForm::SetUpdateAP(bool bUpdateAP) {
s_bUpdateAP = bUpdateAP;
}
-CFX_ByteString CPDF_InterForm::GenerateNewResourceName(
+ByteString CPDF_InterForm::GenerateNewResourceName(
const CPDF_Dictionary* pResDict,
const char* csType,
int iMinLen,
const char* csPrefix) {
- CFX_ByteString csStr = csPrefix;
- CFX_ByteString csBType = csType;
+ ByteString csStr = csPrefix;
+ ByteString csBType = csType;
if (csStr.IsEmpty()) {
if (csBType == "ExtGState")
csStr = "GS";
@@ -688,7 +687,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName(
else
csStr = "Res";
}
- CFX_ByteString csTmp = csStr;
+ ByteString csTmp = csStr;
int iCount = csStr.GetLength();
int m = 0;
if (iMinLen > 0) {
@@ -710,9 +709,9 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName(
return csTmp;
int num = 0;
- CFX_ByteString bsNum;
+ ByteString bsNum;
while (true) {
- CFX_ByteString csKey = csTmp + bsNum;
+ ByteString csKey = csTmp + bsNum;
if (!pDict->KeyExist(csKey))
return csKey;
if (m < iCount)
@@ -726,7 +725,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName(
}
CPDF_Font* CPDF_InterForm::AddStandardFont(CPDF_Document* pDocument,
- CFX_ByteString csFontName) {
+ ByteString csFontName) {
if (!pDocument || csFontName.IsEmpty())
return nullptr;
@@ -737,8 +736,8 @@ CPDF_Font* CPDF_InterForm::AddStandardFont(CPDF_Document* pDocument,
return pDocument->AddStandardFont(csFontName.c_str(), &encoding);
}
-CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) {
- CFX_ByteString csFontName;
+ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) {
+ ByteString csFontName;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
LOGFONTA lf = {};
if (charSet == FX_CHARSET_ANSI) {
@@ -786,7 +785,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet,
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
LOGFONTA lf;
- CFX_ByteString csFontName = GetNativeFont(charSet, &lf);
+ ByteString csFontName = GetNativeFont(charSet, &lf);
if (!csFontName.IsEmpty()) {
if (csFontName == "Helvetica")
return AddStandardFont(pDocument, csFontName);
@@ -801,7 +800,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(CPDF_Document* pDocument) {
}
bool CPDF_InterForm::ValidateFieldName(
- CFX_WideString& csNewFieldName,
+ WideString& csNewFieldName,
int iType,
const CPDF_FormField* pExcludedField,
const CPDF_FormControl* pExcludedControl) const {
@@ -810,7 +809,7 @@ bool CPDF_InterForm::ValidateFieldName(
int iPos = 0;
int iLength = csNewFieldName.GetLength();
- CFX_WideString csSub;
+ WideString csSub;
while (true) {
while (iPos < iLength &&
(csNewFieldName[iPos] == L'.' || csNewFieldName[iPos] == L' ')) {
@@ -835,7 +834,7 @@ bool CPDF_InterForm::ValidateFieldName(
if (!pExcludedControl || pField->CountControls() < 2)
continue;
}
- CFX_WideString csFullName = pField->GetFullName();
+ WideString csFullName = pField->GetFullName();
int iRet = CompareFieldName(csSub, csFullName);
if (iRet == 1) {
if (pField->GetFieldType() != iType)
@@ -858,7 +857,7 @@ bool CPDF_InterForm::ValidateFieldName(
return true;
}
-size_t CPDF_InterForm::CountFields(const CFX_WideString& csFieldName) const {
+size_t CPDF_InterForm::CountFields(const WideString& csFieldName) const {
if (csFieldName.IsEmpty())
return m_pFieldTree->m_Root.CountFields();
@@ -866,9 +865,8 @@ size_t CPDF_InterForm::CountFields(const CFX_WideString& csFieldName) const {
return pNode ? pNode->CountFields() : 0;
}
-CPDF_FormField* CPDF_InterForm::GetField(
- uint32_t index,
- const CFX_WideString& csFieldName) const {
+CPDF_FormField* CPDF_InterForm::GetField(uint32_t index,
+ const WideString& csFieldName) const {
if (csFieldName.IsEmpty())
return m_pFieldTree->m_Root.GetFieldAtIndex(index);
@@ -881,7 +879,7 @@ CPDF_FormField* CPDF_InterForm::GetFieldByDict(
if (!pFieldDict)
return nullptr;
- CFX_WideString csWName = FPDF_GetFullName(pFieldDict);
+ WideString csWName = FPDF_GetFullName(pFieldDict);
return m_pFieldTree->GetField(csWName);
}
@@ -960,7 +958,7 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) {
return -1;
}
-CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csNameTag) const {
+CPDF_Font* CPDF_InterForm::GetFormFont(ByteString csNameTag) const {
return GetFont(m_pFormDict.Get(), m_pDocument.Get(), csNameTag);
}
@@ -1070,7 +1068,7 @@ void CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
}
CPDF_Dictionary* pDict = pFieldDict;
- CFX_WideString csWName = FPDF_GetFullName(pFieldDict);
+ WideString csWName = FPDF_GetFullName(pFieldDict);
if (csWName.IsEmpty())
return;
@@ -1177,7 +1175,7 @@ bool CPDF_InterForm::CheckRequiredFields(
}
std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
- const CFX_WideString& pdf_path,
+ const WideString& pdf_path,
bool bSimpleFileSpec) const {
std::vector<CPDF_FormField*> fields;
size_t nCount = m_pFieldTree->m_Root.CountFields();
@@ -1187,7 +1185,7 @@ std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
}
std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
- const CFX_WideString& pdf_path,
+ const WideString& pdf_path,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bSimpleFileSpec) const {
@@ -1198,9 +1196,9 @@ std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
CPDF_Dictionary* pMainDict = pDoc->GetRoot()->GetDictFor("FDF");
if (!pdf_path.IsEmpty()) {
if (bSimpleFileSpec) {
- CFX_WideString wsFilePath = CPDF_FileSpec::EncodeFileName(pdf_path);
+ WideString wsFilePath = CPDF_FileSpec::EncodeFileName(pdf_path);
pMainDict->SetNewFor<CPDF_String>(
- "F", CFX_ByteString::FromUnicode(wsFilePath), false);
+ "F", ByteString::FromUnicode(wsFilePath), false);
pMainDict->SetNewFor<CPDF_String>("UF", PDF_EncodeText(wsFilePath),
false);
} else {
@@ -1230,14 +1228,14 @@ std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
continue;
}
- CFX_WideString fullname = FPDF_GetFullName(pField->GetFieldDict());
+ WideString fullname = FPDF_GetFullName(pField->GetFieldDict());
auto pFieldDict =
pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool());
pFieldDict->SetNewFor<CPDF_String>("T", fullname);
if (pField->GetType() == CPDF_FormField::CheckBox ||
pField->GetType() == CPDF_FormField::RadioButton) {
- CFX_WideString csExport = pField->GetCheckValue(false);
- CFX_ByteString csBExport = PDF_EncodeText(csExport);
+ WideString csExport = pField->GetCheckValue(false);
+ ByteString csBExport = PDF_EncodeText(csExport);
CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->GetDict(), "Opt");
if (pOpt)
pFieldDict->SetNewFor<CPDF_String>("V", csBExport, false);
@@ -1255,10 +1253,10 @@ std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
}
void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
- const CFX_WideString& parent_name,
+ const WideString& parent_name,
bool bNotify,
int nLevel) {
- CFX_WideString name;
+ WideString name;
if (!parent_name.IsEmpty())
name = parent_name + L".";
@@ -1281,7 +1279,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
if (!pField)
return;
- CFX_WideString csWValue = GetFieldValue(*pFieldDict, m_bsEncoding);
+ WideString csWValue = GetFieldValue(*pFieldDict, m_bsEncoding);
int iType = pField->GetFieldType();
if (bNotify && m_pFormNotify) {
if (iType == FIELDTYPE_LISTBOX) {
diff --git a/core/fpdfdoc/cpdf_interform.h b/core/fpdfdoc/cpdf_interform.h
index 9dc0532939..d3796e5752 100644
--- a/core/fpdfdoc/cpdf_interform.h
+++ b/core/fpdfdoc/cpdf_interform.h
@@ -30,7 +30,7 @@ class IPDF_FormNotify;
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
- CFX_ByteString* csNameTag);
+ ByteString* csNameTag);
class CPDF_InterForm {
public:
@@ -39,20 +39,19 @@ class CPDF_InterForm {
static void SetUpdateAP(bool bUpdateAP);
static bool IsUpdateAPEnabled();
- static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict,
- const char* csType,
- int iMinLen,
- const char* csPrefix);
+ static ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict,
+ const char* csType,
+ int iMinLen,
+ const char* csPrefix);
static CPDF_Font* AddStandardFont(CPDF_Document* pDocument,
- CFX_ByteString csFontName);
- static CFX_ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont);
+ ByteString csFontName);
+ static ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont);
static uint8_t GetNativeCharSet();
static CPDF_Font* AddNativeFont(uint8_t iCharSet, CPDF_Document* pDocument);
static CPDF_Font* AddNativeFont(CPDF_Document* pDocument);
- size_t CountFields(const CFX_WideString& csFieldName) const;
- CPDF_FormField* GetField(uint32_t index,
- const CFX_WideString& csFieldName) const;
+ size_t CountFields(const WideString& csFieldName) const;
+ CPDF_FormField* GetField(uint32_t index, const WideString& csFieldName) const;
CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const;
CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage,
@@ -65,18 +64,18 @@ class CPDF_InterForm {
CPDF_FormField* GetFieldInCalculationOrder(int index);
int FindFieldInCalculationOrder(const CPDF_FormField* pField);
- CPDF_Font* GetFormFont(CFX_ByteString csNameTag) const;
+ CPDF_Font* GetFormFont(ByteString csNameTag) const;
CPDF_DefaultAppearance GetDefaultAppearance() const;
int GetFormAlignment() const;
bool CheckRequiredFields(const std::vector<CPDF_FormField*>* fields,
bool bIncludeOrExclude) const;
- std::unique_ptr<CFDF_Document> ExportToFDF(const CFX_WideString& pdf_path,
+ std::unique_ptr<CFDF_Document> ExportToFDF(const WideString& pdf_path,
bool bSimpleFileSpec) const;
std::unique_ptr<CFDF_Document> ExportToFDF(
- const CFX_WideString& pdf_path,
+ const WideString& pdf_path,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bSimpleFileSpec) const;
@@ -99,10 +98,10 @@ class CPDF_InterForm {
CPDF_FormControl* AddControl(CPDF_FormField* pField,
CPDF_Dictionary* pWidgetDict);
void FDF_ImportField(CPDF_Dictionary* pField,
- const CFX_WideString& parent_name,
+ const WideString& parent_name,
bool bNotify = false,
int nLevel = 0);
- bool ValidateFieldName(CFX_WideString& csNewFieldName,
+ bool ValidateFieldName(WideString& csNewFieldName,
int iType,
const CPDF_FormField* pExcludedField,
const CPDF_FormControl* pExcludedControl) const;
@@ -114,7 +113,7 @@ class CPDF_InterForm {
std::map<const CPDF_Dictionary*, std::unique_ptr<CPDF_FormControl>>
m_ControlMap;
std::unique_ptr<CFieldTree> m_pFieldTree;
- CFX_ByteString m_bsEncoding;
+ ByteString m_bsEncoding;
CFX_UnownedPtr<IPDF_FormNotify> m_pFormNotify;
};
diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp
index d225d3f0bf..bdbf8b467e 100644
--- a/core/fpdfdoc/cpdf_nametree.cpp
+++ b/core/fpdfdoc/cpdf_nametree.cpp
@@ -19,11 +19,10 @@ namespace {
const int nMaxRecursion = 32;
-std::pair<CFX_WideString, CFX_WideString> GetNodeLimitsMaybeSwap(
- CPDF_Array* pLimits) {
+std::pair<WideString, WideString> GetNodeLimitsMaybeSwap(CPDF_Array* pLimits) {
ASSERT(pLimits);
- CFX_WideString csLeft = pLimits->GetUnicodeTextAt(0);
- CFX_WideString csRight = pLimits->GetUnicodeTextAt(1);
+ WideString csLeft = pLimits->GetUnicodeTextAt(0);
+ WideString csRight = pLimits->GetUnicodeTextAt(1);
// If the lower limit is greater than the upper limit, swap them.
if (csLeft.Compare(csRight) > 0) {
pLimits->SetNewAt<CPDF_String>(0, csRight);
@@ -71,14 +70,14 @@ bool GetNodeAncestorsLimits(const CPDF_Dictionary* pNode,
// if needed, and any ancestors that are now empty will be removed.
bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode,
const CPDF_Array* pFind,
- const CFX_WideString& csName,
+ const WideString& csName,
int nLevel) {
if (nLevel > nMaxRecursion)
return false;
CPDF_Array* pLimits = pNode->GetArrayFor("Limits");
- CFX_WideString csLeft;
- CFX_WideString csRight;
+ WideString csLeft;
+ WideString csRight;
if (pLimits)
std::tie(csLeft, csRight) = GetNodeLimitsMaybeSwap(pLimits);
@@ -93,10 +92,10 @@ bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode,
// Since |csName| defines |pNode|'s limits, we need to loop through the
// names to find the new lower and upper limits.
- CFX_WideString csNewLeft = csRight;
- CFX_WideString csNewRight = csLeft;
+ WideString csNewLeft = csRight;
+ WideString csNewRight = csLeft;
for (size_t i = 0; i < pNames->GetCount() / 2; ++i) {
- CFX_WideString wsName = pNames->GetUnicodeTextAt(i * 2);
+ WideString wsName = pNames->GetUnicodeTextAt(i * 2);
if (wsName.Compare(csNewLeft) < 0)
csNewLeft = wsName;
if (wsName.Compare(csNewRight) > 0)
@@ -131,8 +130,8 @@ bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode,
// Since |csName| defines |pNode|'s limits, we need to loop through the
// kids to find the new lower and upper limits.
- CFX_WideString csNewLeft = csRight;
- CFX_WideString csNewRight = csLeft;
+ WideString csNewLeft = csRight;
+ WideString csNewRight = csLeft;
for (size_t j = 0; j < pKids->GetCount(); ++j) {
CPDF_Array* pKidLimits = pKids->GetDictAt(j)->GetArrayFor("Limits");
ASSERT(pKidLimits);
@@ -155,7 +154,7 @@ bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode,
// will be the leaf array that |csName| should be added to, and |pFindIndex|
// will be the index that it should be added at.
CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
- const CFX_WideString& csName,
+ const WideString& csName,
size_t& nIndex,
int nLevel,
CPDF_Array** ppFind,
@@ -166,8 +165,8 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
CPDF_Array* pLimits = pNode->GetArrayFor("Limits");
CPDF_Array* pNames = pNode->GetArrayFor("Names");
if (pLimits) {
- CFX_WideString csLeft;
- CFX_WideString csRight;
+ WideString csLeft;
+ WideString csRight;
std::tie(csLeft, csRight) = GetNodeLimitsMaybeSwap(pLimits);
// Skip this node if the name to look for is smaller than its lower limit.
if (csName.Compare(csLeft) < 0)
@@ -189,7 +188,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (pNames) {
size_t dwCount = pNames->GetCount() / 2;
for (size_t i = 0; i < dwCount; i++) {
- CFX_WideString csValue = pNames->GetUnicodeTextAt(i * 2);
+ WideString csValue = pNames->GetUnicodeTextAt(i * 2);
int32_t iCompare = csValue.Compare(csName);
if (iCompare > 0)
break;
@@ -233,7 +232,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
size_t nIndex,
size_t& nCurIndex,
int nLevel,
- CFX_WideString* csName,
+ WideString* csName,
CPDF_Array** ppFind,
int* pFindIndex) {
if (nLevel > nMaxRecursion)
@@ -300,7 +299,7 @@ size_t CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
CPDF_NameTree::CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {}
CPDF_NameTree::CPDF_NameTree(const CPDF_Document* pDoc,
- const CFX_ByteString& category)
+ const ByteString& category)
: m_pRoot(nullptr) {
const CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot)
@@ -319,7 +318,7 @@ size_t CPDF_NameTree::GetCount() const {
return m_pRoot ? ::CountNames(m_pRoot.Get()) : 0;
}
-int CPDF_NameTree::GetIndex(const CFX_WideString& csName) const {
+int CPDF_NameTree::GetIndex(const WideString& csName) const {
if (!m_pRoot)
return -1;
@@ -330,7 +329,7 @@ int CPDF_NameTree::GetIndex(const CFX_WideString& csName) const {
}
bool CPDF_NameTree::AddValueAndName(std::unique_ptr<CPDF_Object> pObj,
- const CFX_WideString& name) {
+ const WideString& name) {
if (!m_pRoot)
return false;
@@ -347,7 +346,7 @@ bool CPDF_NameTree::AddValueAndName(std::unique_ptr<CPDF_Object> pObj,
// |name| and |pObj|.
if (!pFind) {
size_t nCurIndex = 0;
- CFX_WideString csName;
+ WideString csName;
SearchNameNode(m_pRoot.Get(), 0, nCurIndex, 0, &csName, &pFind, nullptr);
}
ASSERT(pFind);
@@ -381,7 +380,7 @@ bool CPDF_NameTree::DeleteValueAndName(int nIndex) {
return false;
size_t nCurIndex = 0;
- CFX_WideString csName;
+ WideString csName;
CPDF_Array* pFind = nullptr;
int nFindIndex = -1;
// Fail if the tree does not contain |nIndex|.
@@ -400,7 +399,7 @@ bool CPDF_NameTree::DeleteValueAndName(int nIndex) {
}
CPDF_Object* CPDF_NameTree::LookupValueAndName(int nIndex,
- CFX_WideString* csName) const {
+ WideString* csName) const {
csName->clear();
if (!m_pRoot)
return nullptr;
@@ -410,7 +409,7 @@ CPDF_Object* CPDF_NameTree::LookupValueAndName(int nIndex,
nullptr);
}
-CPDF_Object* CPDF_NameTree::LookupValue(const CFX_WideString& csName) const {
+CPDF_Object* CPDF_NameTree::LookupValue(const WideString& csName) const {
if (!m_pRoot)
return nullptr;
@@ -419,7 +418,7 @@ CPDF_Object* CPDF_NameTree::LookupValue(const CFX_WideString& csName) const {
}
CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
- const CFX_WideString& sName) {
+ const WideString& sName) {
CPDF_Object* pValue = LookupValue(sName);
if (!pValue) {
CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictFor("Dests");
diff --git a/core/fpdfdoc/cpdf_nametree.h b/core/fpdfdoc/cpdf_nametree.h
index 4dc43fc3ac..add62f1767 100644
--- a/core/fpdfdoc/cpdf_nametree.h
+++ b/core/fpdfdoc/cpdf_nametree.h
@@ -20,18 +20,18 @@ class CPDF_Object;
class CPDF_NameTree {
public:
explicit CPDF_NameTree(CPDF_Dictionary* pRoot);
- CPDF_NameTree(const CPDF_Document* pDoc, const CFX_ByteString& category);
+ CPDF_NameTree(const CPDF_Document* pDoc, const ByteString& category);
~CPDF_NameTree();
bool AddValueAndName(std::unique_ptr<CPDF_Object> pObj,
- const CFX_WideString& name);
+ const WideString& name);
bool DeleteValueAndName(int nIndex);
- CPDF_Object* LookupValueAndName(int nIndex, CFX_WideString* csName) const;
- CPDF_Object* LookupValue(const CFX_WideString& csName) const;
- CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const CFX_WideString& sName);
+ CPDF_Object* LookupValueAndName(int nIndex, WideString* csName) const;
+ CPDF_Object* LookupValue(const WideString& csName) const;
+ CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const WideString& sName);
- int GetIndex(const CFX_WideString& csName) const;
+ int GetIndex(const WideString& csName) const;
size_t GetCount() const;
CPDF_Dictionary* GetRoot() const { return m_pRoot.Get(); }
diff --git a/core/fpdfdoc/cpdf_nametree_unittest.cpp b/core/fpdfdoc/cpdf_nametree_unittest.cpp
index e6e188a72c..38c3140b90 100644
--- a/core/fpdfdoc/cpdf_nametree_unittest.cpp
+++ b/core/fpdfdoc/cpdf_nametree_unittest.cpp
@@ -84,17 +84,17 @@ TEST(cpdf_nametree, GetUnicodeNameWithBOM) {
constexpr char kData[] = "\xFE\xFF\x00\x31";
for (size_t i = 0; i < sizeof(kData); ++i)
buf.put(kData[i]);
- pNames->AddNew<CPDF_String>(CFX_ByteString(buf), true);
+ pNames->AddNew<CPDF_String>(ByteString(buf), true);
pNames->AddNew<CPDF_Number>(100);
// Check that the key is as expected.
CPDF_NameTree nameTree(pRootDict.get());
- CFX_WideString storedName;
+ WideString storedName;
nameTree.LookupValueAndName(0, &storedName);
EXPECT_STREQ(L"1", storedName.c_str());
// Check that the correct value object can be obtained by looking up "1".
- CFX_WideString matchName = L"1";
+ WideString matchName = L"1";
CPDF_Object* pObj = nameTree.LookupValue(matchName);
ASSERT_TRUE(pObj->IsNumber());
EXPECT_EQ(100, pObj->AsNumber()->GetInteger());
@@ -232,7 +232,7 @@ TEST(cpdf_nametree, DeleteFromKids) {
// Delete the name "9.txt", and check that its node gets deleted and its
// parent node's limits get updated.
- CFX_WideString csName;
+ WideString csName;
ASSERT_TRUE(nameTree.LookupValue(L"9.txt"));
EXPECT_EQ(999, nameTree.LookupValue(L"9.txt")->GetInteger());
EXPECT_TRUE(nameTree.LookupValueAndName(4, &csName));
diff --git a/core/fpdfdoc/cpdf_occontext.cpp b/core/fpdfdoc/cpdf_occontext.cpp
index 7e746e0028..069292c65b 100644
--- a/core/fpdfdoc/cpdf_occontext.cpp
+++ b/core/fpdfdoc/cpdf_occontext.cpp
@@ -24,13 +24,13 @@ int32_t FindGroup(const CPDF_Array* pArray, const CPDF_Dictionary* pGroupDict) {
}
bool HasIntent(const CPDF_Dictionary* pDict,
- const CFX_ByteStringC& csElement,
- const CFX_ByteStringC& csDef) {
+ const ByteStringView& csElement,
+ const ByteStringView& csDef) {
CPDF_Object* pIntent = pDict->GetDirectObjectFor("Intent");
if (!pIntent)
return csElement == csDef;
- CFX_ByteString bsIntent;
+ ByteString bsIntent;
if (CPDF_Array* pArray = pIntent->AsArray()) {
for (size_t i = 0; i < pArray->GetCount(); i++) {
bsIntent = pArray->GetStringAt(i);
@@ -70,8 +70,8 @@ CPDF_Dictionary* GetConfig(CPDF_Document* pDoc,
return pConfig;
}
-CFX_ByteString GetUsageTypeString(CPDF_OCContext::UsageType eType) {
- CFX_ByteString csState;
+ByteString GetUsageTypeString(CPDF_OCContext::UsageType eType) {
+ ByteString csState;
switch (eType) {
case CPDF_OCContext::Design:
csState = "Design";
@@ -99,7 +99,7 @@ CPDF_OCContext::CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType)
CPDF_OCContext::~CPDF_OCContext() {}
bool CPDF_OCContext::LoadOCGStateFromConfig(
- const CFX_ByteString& csConfig,
+ const ByteString& csConfig,
const CPDF_Dictionary* pOCGDict) const {
CPDF_Dictionary* pConfig = GetConfig(m_pDocument.Get(), pOCGDict);
if (!pConfig)
@@ -120,7 +120,7 @@ bool CPDF_OCContext::LoadOCGStateFromConfig(
if (!pArray)
return bState;
- CFX_ByteString csFind = csConfig + "State";
+ ByteString csFind = csConfig + "State";
for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Dictionary* pUsage = pArray->GetDictAt(i);
if (!pUsage)
@@ -149,12 +149,12 @@ bool CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const {
if (!HasIntent(pOCGDict, "View", "View"))
return true;
- CFX_ByteString csState = GetUsageTypeString(m_eUsageType);
+ ByteString csState = GetUsageTypeString(m_eUsageType);
CPDF_Dictionary* pUsage = pOCGDict->GetDictFor("Usage");
if (pUsage) {
CPDF_Dictionary* pState = pUsage->GetDictFor(csState);
if (pState) {
- CFX_ByteString csFind = csState + "State";
+ ByteString csFind = csState + "State";
if (pState->KeyExist(csFind))
return pState->GetStringFor(csFind) != "OFF";
}
@@ -196,7 +196,7 @@ bool CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, int nLevel) {
if (nLevel > 32 || !pExpression)
return false;
- CFX_ByteString csOperator = pExpression->GetStringAt(0);
+ ByteString csOperator = pExpression->GetStringAt(0);
if (csOperator == "Not") {
CPDF_Object* pOCGObj = pExpression->GetDirectObjectAt(1);
if (!pOCGObj)
@@ -241,7 +241,7 @@ bool CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict) {
if (pVE)
return GetOCGVE(pVE, 0);
- CFX_ByteString csP = pOCMDDict->GetStringFor("P", "AnyOn");
+ ByteString csP = pOCMDDict->GetStringFor("P", "AnyOn");
CPDF_Object* pOCGObj = pOCMDDict->GetDirectObjectFor("OCGs");
if (!pOCGObj)
return true;
@@ -279,7 +279,7 @@ bool CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary* pOCGDict) {
if (!pOCGDict)
return true;
- CFX_ByteString csType = pOCGDict->GetStringFor("Type", "OCG");
+ ByteString csType = pOCGDict->GetStringFor("Type", "OCG");
if (csType == "OCG")
return GetOCGVisible(pOCGDict);
return LoadOCMDState(pOCGDict);
diff --git a/core/fpdfdoc/cpdf_occontext.h b/core/fpdfdoc/cpdf_occontext.h
index ea8eea2489..3c93ef1d59 100644
--- a/core/fpdfdoc/cpdf_occontext.h
+++ b/core/fpdfdoc/cpdf_occontext.h
@@ -31,7 +31,7 @@ class CPDF_OCContext : public CFX_Retainable {
CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType);
~CPDF_OCContext() override;
- bool LoadOCGStateFromConfig(const CFX_ByteString& csConfig,
+ bool LoadOCGStateFromConfig(const ByteString& csConfig,
const CPDF_Dictionary* pOCGDict) const;
bool LoadOCGState(const CPDF_Dictionary* pOCGDict) const;
bool GetOCGVisible(const CPDF_Dictionary* pOCGDict);
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index 7b5e66e585..5efb18ef3d 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -13,16 +13,15 @@
namespace {
-CFX_WideString MakeRoman(int num) {
+WideString MakeRoman(int num) {
const int kArabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
- const CFX_WideString kRoman[] = {L"m", L"cm", L"d", L"cd", L"c",
- L"xc", L"l", L"xl", L"x", L"ix",
- L"v", L"iv", L"i"};
+ const WideString kRoman[] = {L"m", L"cm", L"d", L"cd", L"c", L"xc", L"l",
+ L"xl", L"x", L"ix", L"v", L"iv", L"i"};
const int kMaxNum = 1000000;
num %= kMaxNum;
int i = 0;
- CFX_WideString wsRomanNumber;
+ WideString wsRomanNumber;
while (num > 0) {
while (num >= kArabic[i]) {
num = num - kArabic[i];
@@ -33,11 +32,11 @@ CFX_WideString MakeRoman(int num) {
return wsRomanNumber;
}
-CFX_WideString MakeLetters(int num) {
+WideString MakeLetters(int num) {
if (num == 0)
- return CFX_WideString();
+ return WideString();
- CFX_WideString wsLetters;
+ WideString wsLetters;
const int nMaxCount = 1000;
const int nLetterCount = 26;
--num;
@@ -50,8 +49,8 @@ CFX_WideString MakeLetters(int num) {
return wsLetters;
}
-CFX_WideString GetLabelNumPortion(int num, const CFX_ByteString& bsStyle) {
- CFX_WideString wsNumPortion;
+WideString GetLabelNumPortion(int num, const ByteString& bsStyle) {
+ WideString wsNumPortion;
if (bsStyle.IsEmpty())
return wsNumPortion;
if (bsStyle == "D") {
@@ -77,7 +76,7 @@ CPDF_PageLabel::CPDF_PageLabel(CPDF_Document* pDocument)
CPDF_PageLabel::~CPDF_PageLabel() {}
-bool CPDF_PageLabel::GetLabel(int nPage, CFX_WideString* wsLabel) const {
+bool CPDF_PageLabel::GetLabel(int nPage, WideString* wsLabel) const {
if (!m_pDocument)
return false;
@@ -108,10 +107,9 @@ bool CPDF_PageLabel::GetLabel(int nPage, CFX_WideString* wsLabel) const {
if (pLabel->KeyExist("P"))
*wsLabel += pLabel->GetUnicodeTextFor("P");
- CFX_ByteString bsNumberingStyle = pLabel->GetStringFor("S", "");
+ ByteString bsNumberingStyle = pLabel->GetStringFor("S", "");
int nLabelNum = nPage - n + pLabel->GetIntegerFor("St", 1);
- CFX_WideString wsNumPortion =
- GetLabelNumPortion(nLabelNum, bsNumberingStyle);
+ WideString wsNumPortion = GetLabelNumPortion(nLabelNum, bsNumberingStyle);
*wsLabel += wsNumPortion;
return true;
}
@@ -120,7 +118,7 @@ bool CPDF_PageLabel::GetLabel(int nPage, CFX_WideString* wsLabel) const {
return true;
}
-int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
+int32_t CPDF_PageLabel::GetPageByLabel(const ByteStringView& bsLabel) const {
if (!m_pDocument)
return -1;
@@ -130,19 +128,19 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
int nPages = m_pDocument->GetPageCount();
for (int i = 0; i < nPages; i++) {
- CFX_WideString str;
+ WideString str;
if (!GetLabel(i, &str))
continue;
if (PDF_EncodeText(str).Compare(bsLabel))
return i;
}
- int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate.
+ int nPage = FXSYS_atoi(ByteString(bsLabel).c_str()); // NUL terminate.
return nPage > 0 && nPage <= nPages ? nPage : -1;
}
-int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const {
+int32_t CPDF_PageLabel::GetPageByLabel(const WideStringView& wsLabel) const {
// TODO(tsepez): check usage of c_str() below.
return GetPageByLabel(
- PDF_EncodeText(wsLabel.unterminated_c_str()).AsStringC());
+ PDF_EncodeText(wsLabel.unterminated_c_str()).AsStringView());
}
diff --git a/core/fpdfdoc/cpdf_pagelabel.h b/core/fpdfdoc/cpdf_pagelabel.h
index 66324f87c6..1b21ca8bdb 100644
--- a/core/fpdfdoc/cpdf_pagelabel.h
+++ b/core/fpdfdoc/cpdf_pagelabel.h
@@ -16,9 +16,9 @@ class CPDF_PageLabel {
explicit CPDF_PageLabel(CPDF_Document* pDocument);
~CPDF_PageLabel();
- bool GetLabel(int nPage, CFX_WideString* wsLabel) const;
- int32_t GetPageByLabel(const CFX_ByteStringC& bsLabel) const;
- int32_t GetPageByLabel(const CFX_WideStringC& wsLabel) const;
+ bool GetLabel(int nPage, WideString* wsLabel) const;
+ int32_t GetPageByLabel(const ByteStringView& bsLabel) const;
+ int32_t GetPageByLabel(const WideStringView& wsLabel) const;
private:
CFX_UnownedPtr<CPDF_Document> const m_pDocument;
diff --git a/core/fpdfdoc/cpdf_structelement.cpp b/core/fpdfdoc/cpdf_structelement.cpp
index c5f2b6bd79..0b0b542852 100644
--- a/core/fpdfdoc/cpdf_structelement.cpp
+++ b/core/fpdfdoc/cpdf_structelement.cpp
@@ -36,7 +36,7 @@ CPDF_StructElement::CPDF_StructElement(CPDF_StructTree* pTree,
m_Type(pDict->GetStringFor("S")),
m_Title(pDict->GetStringFor("T")) {
if (pTree->GetRoleMap()) {
- CFX_ByteString mapped = pTree->GetRoleMap()->GetStringFor(m_Type);
+ ByteString mapped = pTree->GetRoleMap()->GetStringFor(m_Type);
if (!mapped.IsEmpty())
m_Type = mapped;
}
@@ -102,7 +102,7 @@ void CPDF_StructElement::LoadKid(uint32_t PageObjNum,
if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectFor("Pg")))
PageObjNum = pRef->GetRefObjNum();
- CFX_ByteString type = pKidDict->GetStringFor("Type");
+ ByteString type = pKidDict->GetStringFor("Type");
if ((type == "MCR" || type == "OBJR") && m_pTree->GetPage() &&
m_pTree->GetPage()->GetObjNum() != PageObjNum) {
return;
diff --git a/core/fpdfdoc/cpdf_structelement.h b/core/fpdfdoc/cpdf_structelement.h
index 8fe73e51c8..b54487e7f8 100644
--- a/core/fpdfdoc/cpdf_structelement.h
+++ b/core/fpdfdoc/cpdf_structelement.h
@@ -39,8 +39,8 @@ class CPDF_StructElement : public CFX_Retainable {
template <typename T, typename... Args>
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- const CFX_ByteString& GetType() const { return m_Type; }
- const CFX_ByteString& GetTitle() const { return m_Title; }
+ const ByteString& GetType() const { return m_Type; }
+ const ByteString& GetTitle() const { return m_Title; }
CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
int CountKids() const;
@@ -59,8 +59,8 @@ class CPDF_StructElement : public CFX_Retainable {
CFX_UnownedPtr<CPDF_StructTree> const m_pTree;
CFX_UnownedPtr<CPDF_StructElement> const m_pParent;
CFX_UnownedPtr<CPDF_Dictionary> const m_pDict;
- CFX_ByteString m_Type;
- CFX_ByteString m_Title;
+ ByteString m_Type;
+ ByteString m_Title;
std::vector<CPDF_StructKid> m_Kids;
};
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index 877f8ca01e..d3de6129f1 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -354,7 +354,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(
CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place,
const wchar_t* text) {
- CFX_WideString swText = text;
+ WideString swText = text;
CPVT_WordPlace wp = place;
for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
CPVT_WordPlace oldwp = wp;
@@ -412,7 +412,7 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace& place) {
return ClearLeftWord(AdjustLineHeader(place, true));
}
-void CPDF_VariableText::SetText(const CFX_WideString& swText) {
+void CPDF_VariableText::SetText(const WideString& swText) {
DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace()));
CPVT_WordPlace wp(0, 0, -1);
CPVT_SectionInfo secinfo;
diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h
index a226350006..704408c5be 100644
--- a/core/fpdfdoc/cpdf_variabletext.h
+++ b/core/fpdfdoc/cpdf_variabletext.h
@@ -106,7 +106,7 @@ class CPDF_VariableText {
void RearrangeAll();
void RearrangePart(const CPVT_WordRange& PlaceRange);
void ResetAll();
- void SetText(const CFX_WideString& text);
+ void SetText(const WideString& text);
CPVT_WordPlace InsertWord(const CPVT_WordPlace& place,
uint16_t word,
int32_t charset,
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.cpp b/core/fpdfdoc/cpdf_viewerpreferences.cpp
index e25316b6fb..e7fb1416a8 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.cpp
+++ b/core/fpdfdoc/cpdf_viewerpreferences.cpp
@@ -34,13 +34,13 @@ CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const {
return pDict ? pDict->GetArrayFor("PrintPageRange") : nullptr;
}
-CFX_ByteString CPDF_ViewerPreferences::Duplex() const {
+ByteString CPDF_ViewerPreferences::Duplex() const {
CPDF_Dictionary* pDict = GetViewerPreferences();
- return pDict ? pDict->GetStringFor("Duplex") : CFX_ByteString("None");
+ return pDict ? pDict->GetStringFor("Duplex") : ByteString("None");
}
-bool CPDF_ViewerPreferences::GenericName(const CFX_ByteString& bsKey,
- CFX_ByteString* bsVal) const {
+bool CPDF_ViewerPreferences::GenericName(const ByteString& bsKey,
+ ByteString* bsVal) const {
ASSERT(bsVal);
CPDF_Dictionary* pDict = GetViewerPreferences();
if (!pDict)
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.h b/core/fpdfdoc/cpdf_viewerpreferences.h
index 46428a238c..bbe5d1a512 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.h
+++ b/core/fpdfdoc/cpdf_viewerpreferences.h
@@ -24,12 +24,12 @@ class CPDF_ViewerPreferences {
bool PrintScaling() const;
int32_t NumCopies() const;
CPDF_Array* PrintPageRange() const;
- CFX_ByteString Duplex() const;
+ ByteString Duplex() const;
// Gets the entry for |bsKey|. If the entry exists and it is of type name,
// then this method writes the value into |bsVal| and returns true. Otherwise
// returns false and |bsVal| is untouched. |bsVal| must not be NULL.
- bool GenericName(const CFX_ByteString& bsKey, CFX_ByteString* bsVal) const;
+ bool GenericName(const ByteString& bsKey, ByteString* bsVal) const;
private:
CPDF_Dictionary* GetViewerPreferences() const;
diff --git a/core/fpdfdoc/cpvt_color.cpp b/core/fpdfdoc/cpvt_color.cpp
index 584a85aaec..914e416dbd 100644
--- a/core/fpdfdoc/cpvt_color.cpp
+++ b/core/fpdfdoc/cpvt_color.cpp
@@ -9,8 +9,8 @@
#include "core/fpdfapi/parser/cpdf_simple_parser.h"
// Static.
-CPVT_Color CPVT_Color::ParseColor(const CFX_ByteString& str) {
- CPDF_SimpleParser syntax(str.AsStringC());
+CPVT_Color CPVT_Color::ParseColor(const ByteString& str) {
+ CPDF_SimpleParser syntax(str.AsStringView());
if (syntax.FindTagParamFromStart("g", 1))
return CPVT_Color(CPVT_Color::kGray, FX_atof(syntax.GetWord()));
diff --git a/core/fpdfdoc/cpvt_color.h b/core/fpdfdoc/cpvt_color.h
index 2db3b8310e..a7e925bf79 100644
--- a/core/fpdfdoc/cpvt_color.h
+++ b/core/fpdfdoc/cpvt_color.h
@@ -31,7 +31,7 @@ struct CPVT_Color {
float fColor3;
float fColor4;
- static CPVT_Color ParseColor(const CFX_ByteString& str);
+ static CPVT_Color ParseColor(const ByteString& str);
static CPVT_Color ParseColor(const CPDF_Array& array);
};
diff --git a/core/fpdfdoc/cpvt_fontmap.cpp b/core/fpdfdoc/cpvt_fontmap.cpp
index 0edabd1bc3..aaf8661f1e 100644
--- a/core/fpdfdoc/cpvt_fontmap.cpp
+++ b/core/fpdfdoc/cpvt_fontmap.cpp
@@ -17,7 +17,7 @@
CPVT_FontMap::CPVT_FontMap(CPDF_Document* pDoc,
CPDF_Dictionary* pResDict,
CPDF_Font* pDefFont,
- const CFX_ByteString& sDefFontAlias)
+ const ByteString& sDefFontAlias)
: m_pDocument(pDoc),
m_pResDict(pResDict),
m_pDefFont(pDefFont),
@@ -27,7 +27,7 @@ CPVT_FontMap::~CPVT_FontMap() {}
CPDF_Font* CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc,
const CPDF_Dictionary* pResDict,
- CFX_ByteString* sSysFontAlias) {
+ ByteString* sSysFontAlias) {
if (!pDoc || !pResDict)
return nullptr;
@@ -59,7 +59,7 @@ CPDF_Font* CPVT_FontMap::GetPDFFont(int32_t nFontIndex) {
}
}
-CFX_ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
+ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
switch (nFontIndex) {
case 0:
return m_sDefFontAlias;
@@ -70,7 +70,7 @@ CFX_ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
}
return m_sSysFontAlias;
default:
- return CFX_ByteString();
+ return ByteString();
}
}
diff --git a/core/fpdfdoc/cpvt_fontmap.h b/core/fpdfdoc/cpvt_fontmap.h
index da69463d95..feca454774 100644
--- a/core/fpdfdoc/cpvt_fontmap.h
+++ b/core/fpdfdoc/cpvt_fontmap.h
@@ -22,12 +22,12 @@ class CPVT_FontMap : public IPVT_FontMap {
CPVT_FontMap(CPDF_Document* pDoc,
CPDF_Dictionary* pResDict,
CPDF_Font* pDefFont,
- const CFX_ByteString& sDefFontAlias);
+ const ByteString& sDefFontAlias);
~CPVT_FontMap() override;
// IPVT_FontMap:
CPDF_Font* GetPDFFont(int32_t nFontIndex) override;
- CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override;
+ ByteString GetPDFFontAlias(int32_t nFontIndex) override;
int32_t GetWordFontIndex(uint16_t word,
int32_t charset,
int32_t nFontIndex) override;
@@ -36,15 +36,15 @@ class CPVT_FontMap : public IPVT_FontMap {
static CPDF_Font* GetAnnotSysPDFFont(CPDF_Document* pDoc,
const CPDF_Dictionary* pResDict,
- CFX_ByteString* sSysFontAlias);
+ ByteString* sSysFontAlias);
private:
CFX_UnownedPtr<CPDF_Document> const m_pDocument;
CFX_UnownedPtr<CPDF_Dictionary> const m_pResDict;
CFX_UnownedPtr<CPDF_Font> const m_pDefFont;
CFX_UnownedPtr<CPDF_Font> m_pSysFont;
- const CFX_ByteString m_sDefFontAlias;
- CFX_ByteString m_sSysFontAlias;
+ const ByteString m_sDefFontAlias;
+ ByteString m_sSysFontAlias;
};
#endif // CORE_FPDFDOC_CPVT_FONTMAP_H_
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 132e771d47..634864c957 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -42,7 +42,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
if (!pFormDict)
return false;
- CFX_ByteString DA;
+ ByteString DA;
if (CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA"))
DA = pDAObj->GetString();
if (DA.IsEmpty())
@@ -50,9 +50,9 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
if (DA.IsEmpty())
return false;
- CPDF_SimpleParser syntax(DA.AsStringC());
+ CPDF_SimpleParser syntax(DA.AsStringView());
syntax.FindTagParamFromStart("Tf", 2);
- CFX_ByteString sFontName(syntax.GetWord());
+ ByteString sFontName(syntax.GetWord());
sFontName = PDF_NameDecode(sFontName);
if (sFontName.IsEmpty())
return false;
@@ -161,14 +161,13 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
crBG = CPVT_Color::ParseColor(*pArray);
}
std::ostringstream sAppStream;
- CFX_ByteString sBG =
- CPVT_GenerateAP::GenerateColorAP(crBG, PaintOperation::FILL);
+ ByteString sBG = CPVT_GenerateAP::GenerateColorAP(crBG, PaintOperation::FILL);
if (sBG.GetLength() > 0) {
sAppStream << "q\n" << sBG << rcBBox.left << " " << rcBBox.bottom << " "
<< rcBBox.Width() << " " << rcBBox.Height() << " re f\n"
<< "Q\n";
}
- CFX_ByteString sBorderStream = CPVT_GenerateAP::GenerateBorderAP(
+ ByteString sBorderStream = CPVT_GenerateAP::GenerateBorderAP(
rcBBox, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle,
dsBorder);
if (sBorderStream.GetLength() > 0)
@@ -208,10 +207,10 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
}
switch (nWidgetType) {
case 0: {
- CFX_WideString swValue =
+ WideString swValue =
FPDF_GetFieldAttr(pAnnotDict, "V")
? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText()
- : CFX_WideString();
+ : WideString();
int32_t nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q")
? FPDF_GetFieldAttr(pAnnotDict, "Q")->GetInteger()
: 0;
@@ -260,7 +259,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
ptOffset =
CFX_PointF(0.0f, (rcContent.Height() - rcBody.Height()) / 2.0f);
}
- CFX_ByteString sBody = CPVT_GenerateAP::GenerateEditAP(
+ ByteString sBody = CPVT_GenerateAP::GenerateEditAP(
&map, vt.GetIterator(), ptOffset, !bCharArray, subWord);
if (sBody.GetLength() > 0) {
sAppStream << "/Tx BMC\n"
@@ -279,10 +278,10 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
}
} break;
case 1: {
- CFX_WideString swValue =
+ WideString swValue =
FPDF_GetFieldAttr(pAnnotDict, "V")
? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText()
- : CFX_WideString();
+ : WideString();
CPVT_FontMap map(
pDoc, pStreamDict ? pStreamDict->GetDictFor("Resources") : nullptr,
pDefFont, sFontName.Right(sFontName.GetLength() - 1));
@@ -307,8 +306,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
CFX_FloatRect rcContent = vt.GetContentRect();
CFX_PointF ptOffset =
CFX_PointF(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f);
- CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(
- &map, vt.GetIterator(), ptOffset, true, 0);
+ ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
+ ptOffset, true, 0);
if (sEdit.GetLength() > 0) {
sAppStream << "/Tx BMC\n"
<< "q\n";
@@ -320,7 +319,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
<< sEdit << "ET\n"
<< "Q\nEMC\n";
}
- CFX_ByteString sButton = CPVT_GenerateAP::GenerateColorAP(
+ ByteString sButton = CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kRGB, 220.0f / 255.0f, 220.0f / 255.0f,
220.0f / 255.0f),
PaintOperation::FILL);
@@ -329,7 +328,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
sAppStream << rcButton.left << " " << rcButton.bottom << " "
<< rcButton.Width() << " " << rcButton.Height() << " re f\n";
sAppStream << "Q\n";
- CFX_ByteString sButtonBorder = CPVT_GenerateAP::GenerateBorderAP(
+ ByteString sButtonBorder = CPVT_GenerateAP::GenerateBorderAP(
rcButton, 2, CPVT_Color(CPVT_Color::kGray, 0),
CPVT_Color(CPVT_Color::kGray, 1),
CPVT_Color(CPVT_Color::kGray, 0.5), BorderStyle::BEVELED,
@@ -368,7 +367,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
break;
if (CPDF_Object* pOpt = pOpts->GetDirectObjectAt(i)) {
- CFX_WideString swItem;
+ WideString swItem;
if (pOpt->IsString())
swItem = pOpt->GetUnicodeText();
else if (CPDF_Array* pArray = pOpt->AsArray())
@@ -461,9 +460,9 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
return true;
}
-CFX_ByteString GetColorStringWithDefault(CPDF_Array* pColor,
- const CPVT_Color& crDefaultColor,
- PaintOperation nOperation) {
+ByteString GetColorStringWithDefault(CPDF_Array* pColor,
+ const CPVT_Color& crDefaultColor,
+ PaintOperation nOperation) {
if (pColor) {
CPVT_Color color = CPVT_Color::ParseColor(*pColor);
return CPVT_GenerateAP::GenerateColorAP(color, nOperation);
@@ -500,10 +499,10 @@ CPDF_Array* GetDashArray(const CPDF_Dictionary& pAnnotDict) {
return nullptr;
}
-CFX_ByteString GetDashPatternString(const CPDF_Dictionary& pAnnotDict) {
+ByteString GetDashPatternString(const CPDF_Dictionary& pAnnotDict) {
CPDF_Array* pDashArray = GetDashArray(pAnnotDict);
if (!pDashArray || pDashArray->IsEmpty())
- return CFX_ByteString();
+ return ByteString();
// Support maximum of ten elements in the dash array.
size_t pDashArrayCount = std::min<size_t>(pDashArray->GetCount(), 10);
@@ -514,14 +513,14 @@ CFX_ByteString GetDashPatternString(const CPDF_Dictionary& pAnnotDict) {
sDashStream << pDashArray->GetNumberAt(i) << " ";
sDashStream << "] 0 d\n";
- return CFX_ByteString(sDashStream);
+ return ByteString(sDashStream);
}
-CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc,
- const CPDF_Dictionary& pAnnotDict,
- CPDF_Font* pDefFont,
- const CFX_ByteString& sFontName) {
- CFX_WideString swValue(pAnnotDict.GetUnicodeTextFor("T"));
+ByteString GetPopupContentsString(CPDF_Document* pDoc,
+ const CPDF_Dictionary& pAnnotDict,
+ CPDF_Font* pDefFont,
+ const ByteString& sFontName) {
+ WideString swValue(pAnnotDict.GetUnicodeTextFor("T"));
swValue += L'\n';
swValue += pAnnotDict.GetUnicodeTextFor("Contents");
CPVT_FontMap map(pDoc, nullptr, pDefFont, sFontName);
@@ -538,11 +537,11 @@ CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc,
vt.SetText(swValue);
vt.RearrangeAll();
CFX_PointF ptOffset(3.0f, -3.0f);
- CFX_ByteString sContent = CPVT_GenerateAP::GenerateEditAP(
- &map, vt.GetIterator(), ptOffset, false, 0);
+ ByteString sContent = CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
+ ptOffset, false, 0);
if (sContent.IsEmpty())
- return CFX_ByteString();
+ return ByteString();
std::ostringstream sAppStream;
sAppStream << "BT\n"
@@ -550,12 +549,12 @@ CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc,
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0), PaintOperation::FILL)
<< sContent << "ET\n"
<< "Q\n";
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
std::unique_ptr<CPDF_Dictionary> GenerateResourceFontDict(
CPDF_Document* pDoc,
- const CFX_ByteString& sFontDictName) {
+ const ByteString& sFontDictName) {
CPDF_Dictionary* pFontDict = pDoc->NewIndirect<CPDF_Dictionary>();
pFontDict->SetNewFor<CPDF_Name>("Type", "Font");
pFontDict->SetNewFor<CPDF_Name>("Subtype", "Type1");
@@ -569,13 +568,13 @@ std::unique_ptr<CPDF_Dictionary> GenerateResourceFontDict(
return pResourceFontDict;
}
-CFX_ByteString GetPaintOperatorString(bool bIsStrokeRect, bool bIsFillRect) {
+ByteString GetPaintOperatorString(bool bIsStrokeRect, bool bIsFillRect) {
if (bIsStrokeRect)
return bIsFillRect ? "b" : "s";
return bIsFillRect ? "f" : "n";
}
-CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) {
+ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) {
std::ostringstream sAppStream;
sAppStream << CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kRGB, 1, 1, 0), PaintOperation::FILL);
@@ -622,7 +621,7 @@ CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) {
}
sAppStream << "B*\n";
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
} // namespace
@@ -635,7 +634,7 @@ bool FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) {
if (!pFieldTypeObj)
return false;
- CFX_ByteString field_type = pFieldTypeObj->GetString();
+ ByteString field_type = pFieldTypeObj->GetString();
if (field_type == "Tx")
return CPVT_GenerateAP::GenerateTextFieldAP(pDoc, pAnnotDict);
@@ -684,7 +683,7 @@ bool CPVT_GenerateAP::GenerateTextFieldAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
CPDF_Array* pInteriorColor = pAnnotDict->GetArrayFor("IC");
@@ -758,7 +757,7 @@ bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateHighlightAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -796,7 +795,7 @@ bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc,
return false;
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -840,7 +839,7 @@ bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateTextAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
@@ -863,7 +862,7 @@ bool CPVT_GenerateAP::GenerateTextAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -890,7 +889,7 @@ bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GeneratePopupAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs\n";
sAppStream << GenerateColorAP(CPVT_Color(CPVT_Color::kRGB, 1, 1, 0),
@@ -908,7 +907,7 @@ bool CPVT_GenerateAP::GeneratePopupAP(CPDF_Document* pDoc,
sAppStream << rect.left << " " << rect.bottom << " " << rect.Width() << " "
<< rect.Height() << " re b\n";
- CFX_ByteString sFontName = "FONT";
+ ByteString sFontName = "FONT";
auto pResourceFontDict = GenerateResourceFontDict(pDoc, sFontName);
CPDF_Font* pDefFont = pDoc->LoadFont(pResourceFontDict.get());
if (!pDefFont)
@@ -928,7 +927,7 @@ bool CPVT_GenerateAP::GeneratePopupAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
CPDF_Array* pInteriorColor = pAnnotDict->GetArrayFor("IC");
@@ -976,7 +975,7 @@ bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -1025,7 +1024,7 @@ bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc,
bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) {
std::ostringstream sAppStream;
- CFX_ByteString sExtGSDictName = "GS";
+ ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
@@ -1050,7 +1049,7 @@ bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc,
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
+ByteString CPVT_GenerateAP::GenerateEditAP(
IPVT_FontMap* pFontMap,
CPDF_VariableText::Iterator* pIterator,
const CFX_PointF& ptOffset,
@@ -1070,7 +1069,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
if (bContinuous) {
if (place.LineCmp(oldplace) != 0) {
if (sWords.tellp() > 0) {
- sLineStream << GetWordRenderString(CFX_ByteString(sWords));
+ sLineStream << GetWordRenderString(ByteString(sWords));
sEditStream << sLineStream.str();
sLineStream.str("");
sWords.str("");
@@ -1095,7 +1094,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
if (pIterator->GetWord(word)) {
if (word.nFontIndex != nCurFontIndex) {
if (sWords.tellp() > 0) {
- sLineStream << GetWordRenderString(CFX_ByteString(sWords));
+ sLineStream << GetWordRenderString(ByteString(sWords));
sWords.str("");
}
sLineStream << GetFontSetString(pFontMap, word.nFontIndex,
@@ -1126,24 +1125,23 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
}
}
if (sWords.tellp() > 0) {
- sLineStream << GetWordRenderString(CFX_ByteString(sWords));
+ sLineStream << GetWordRenderString(ByteString(sWords));
sEditStream << sLineStream.str();
sWords.str("");
}
- return CFX_ByteString(sEditStream);
+ return ByteString(sEditStream);
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
- const CFX_FloatRect& rect,
- float fWidth,
- const CPVT_Color& color,
- const CPVT_Color& crLeftTop,
- const CPVT_Color& crRightBottom,
- BorderStyle nStyle,
- const CPVT_Dash& dash) {
+ByteString CPVT_GenerateAP::GenerateBorderAP(const CFX_FloatRect& rect,
+ float fWidth,
+ const CPVT_Color& color,
+ const CPVT_Color& crLeftTop,
+ const CPVT_Color& crRightBottom,
+ BorderStyle nStyle,
+ const CPVT_Dash& dash) {
std::ostringstream sAppStream;
- CFX_ByteString sColor;
+ ByteString sColor;
float fLeft = rect.left;
float fRight = rect.right;
float fTop = rect.top;
@@ -1238,12 +1236,12 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
break;
}
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GenerateColorAP(const CPVT_Color& color,
- PaintOperation nOperation) {
+ByteString CPVT_GenerateAP::GenerateColorAP(const CPVT_Color& color,
+ PaintOperation nOperation) {
std::ostringstream sColorStream;
switch (color.nColorType) {
case CPVT_Color::kRGB:
@@ -1266,14 +1264,14 @@ CFX_ByteString CPVT_GenerateAP::GenerateColorAP(const CPVT_Color& color,
case CPVT_Color::kTransparent:
break;
}
- return CFX_ByteString(sColorStream);
+ return ByteString(sColorStream);
}
// Static.
std::unique_ptr<CPDF_Dictionary> CPVT_GenerateAP::GenerateExtGStateDict(
const CPDF_Dictionary& pAnnotDict,
- const CFX_ByteString& sExtGSDictName,
- const CFX_ByteString& sBlendMode) {
+ const ByteString& sExtGSDictName,
+ const ByteString& sBlendMode) {
auto pGSDict =
pdfium::MakeUnique<CPDF_Dictionary>(pAnnotDict.GetByteStringPool());
pGSDict->SetNewFor<CPDF_String>("Type", "ExtGState", false);
@@ -1334,11 +1332,11 @@ void CPVT_GenerateAP::GenerateAndSetAPDict(
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GetPDFWordString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord) {
- CFX_ByteString sWord;
+ByteString CPVT_GenerateAP::GetPDFWordString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord) {
+ ByteString sWord;
if (SubWord > 0) {
sWord.Format("%c", SubWord);
return sWord;
@@ -1361,22 +1359,21 @@ CFX_ByteString CPVT_GenerateAP::GetPDFWordString(IPVT_FontMap* pFontMap,
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GetWordRenderString(
- const CFX_ByteString& strWords) {
+ByteString CPVT_GenerateAP::GetWordRenderString(const ByteString& strWords) {
if (strWords.GetLength() > 0)
return PDF_EncodeString(strWords, false) + " Tj\n";
return "";
}
// Static.
-CFX_ByteString CPVT_GenerateAP::GetFontSetString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- float fFontSize) {
+ByteString CPVT_GenerateAP::GetFontSetString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ float fFontSize) {
std::ostringstream sRet;
if (pFontMap) {
- CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
+ ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
if (sFontAlias.GetLength() > 0 && fFontSize > 0)
sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n";
}
- return CFX_ByteString(sRet);
+ return ByteString(sRet);
}
diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h
index cee96cda50..2812b29a47 100644
--- a/core/fpdfdoc/cpvt_generateap.h
+++ b/core/fpdfdoc/cpvt_generateap.h
@@ -7,6 +7,8 @@
#ifndef CORE_FPDFDOC_CPVT_GENERATEAP_H_
#define CORE_FPDFDOC_CPVT_GENERATEAP_H_
+#include <memory>
+
#include "core/fpdfdoc/cpdf_defaultappearance.h"
#include "core/fpdfdoc/cpdf_variabletext.h"
#include "core/fpdfdoc/cpvt_color.h"
@@ -46,24 +48,24 @@ class CPVT_GenerateAP {
CPDF_Dictionary* pAnnotDict);
static bool GenerateUnderlineAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict);
- static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap,
- CPDF_VariableText::Iterator* pIterator,
- const CFX_PointF& ptOffset,
- bool bContinuous,
- uint16_t SubWord);
- static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect,
- float fWidth,
- const CPVT_Color& color,
- const CPVT_Color& crLeftTop,
- const CPVT_Color& crRightBottom,
- BorderStyle nStyle,
- const CPVT_Dash& dash);
- static CFX_ByteString GenerateColorAP(const CPVT_Color& color,
- PaintOperation nOperation);
+ static ByteString GenerateEditAP(IPVT_FontMap* pFontMap,
+ CPDF_VariableText::Iterator* pIterator,
+ const CFX_PointF& ptOffset,
+ bool bContinuous,
+ uint16_t SubWord);
+ static ByteString GenerateBorderAP(const CFX_FloatRect& rect,
+ float fWidth,
+ const CPVT_Color& color,
+ const CPVT_Color& crLeftTop,
+ const CPVT_Color& crRightBottom,
+ BorderStyle nStyle,
+ const CPVT_Dash& dash);
+ static ByteString GenerateColorAP(const CPVT_Color& color,
+ PaintOperation nOperation);
static std::unique_ptr<CPDF_Dictionary> GenerateExtGStateDict(
const CPDF_Dictionary& pAnnotDict,
- const CFX_ByteString& sExtGSDictName,
- const CFX_ByteString& sBlendMode);
+ const ByteString& sExtGSDictName,
+ const ByteString& sBlendMode);
static std::unique_ptr<CPDF_Dictionary> GenerateResourceDict(
CPDF_Document* pDoc,
std::unique_ptr<CPDF_Dictionary> pExtGStateDict,
@@ -75,14 +77,14 @@ class CPVT_GenerateAP {
std::unique_ptr<CPDF_Dictionary> pResourceDict,
bool bIsTextMarkupAnnotation);
- static CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord);
- static CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords);
- static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- float fFontSize);
+ static ByteString GetPDFWordString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord);
+ static ByteString GetWordRenderString(const ByteString& strWords);
+ static ByteString GetFontSetString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ float fFontSize);
};
#endif // CORE_FPDFDOC_CPVT_GENERATEAP_H_
diff --git a/core/fpdfdoc/ipdf_formnotify.h b/core/fpdfdoc/ipdf_formnotify.h
index bf6127dce2..52e5cc96aa 100644
--- a/core/fpdfdoc/ipdf_formnotify.h
+++ b/core/fpdfdoc/ipdf_formnotify.h
@@ -17,10 +17,10 @@ class IPDF_FormNotify {
virtual ~IPDF_FormNotify() {}
virtual int BeforeValueChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) = 0;
+ const WideString& csValue) = 0;
virtual void AfterValueChange(CPDF_FormField* pField) = 0;
virtual int BeforeSelectionChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) = 0;
+ const WideString& csValue) = 0;
virtual void AfterSelectionChange(CPDF_FormField* pField) = 0;
virtual void AfterCheckedStatusChange(CPDF_FormField* pField) = 0;
virtual int BeforeFormReset(CPDF_InterForm* pForm) = 0;
diff --git a/core/fpdfdoc/ipvt_fontmap.h b/core/fpdfdoc/ipvt_fontmap.h
index 740cb19eb8..31aa73b8a1 100644
--- a/core/fpdfdoc/ipvt_fontmap.h
+++ b/core/fpdfdoc/ipvt_fontmap.h
@@ -18,7 +18,7 @@ class IPVT_FontMap {
virtual ~IPVT_FontMap() {}
virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0;
- virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0;
+ virtual ByteString GetPDFFontAlias(int32_t nFontIndex) = 0;
virtual int32_t GetWordFontIndex(uint16_t word,
int32_t charset,
int32_t nFontIndex) = 0;
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index a5eafe689a..91116711e6 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -19,7 +19,7 @@ namespace {
// |end|. The purpose of this function is to separate url from the surrounding
// context characters, we do not intend to fully validate the url. |str|
// contains lower case characters only.
-FX_STRSIZE FindWebLinkEnding(const CFX_WideString& str,
+FX_STRSIZE FindWebLinkEnding(const WideString& str,
FX_STRSIZE start,
FX_STRSIZE end) {
if (str.Contains(L'/', start)) {
@@ -67,7 +67,7 @@ FX_STRSIZE FindWebLinkEnding(const CFX_WideString& str,
// Remove characters from the end of |str|, delimited by |start| and |end|, up
// to and including |charToFind|. No-op if |charToFind| is not present. Updates
// |end| if characters were removed.
-void TrimBackwardsToChar(const CFX_WideString& str,
+void TrimBackwardsToChar(const WideString& str,
wchar_t charToFind,
FX_STRSIZE start,
FX_STRSIZE* end) {
@@ -83,7 +83,7 @@ void TrimBackwardsToChar(const CFX_WideString& str,
// |start| and |end| in |str|. Matches a closing bracket or quote for each
// opening character and, if present, removes everything afterwards. Returns the
// new end position for the string.
-FX_STRSIZE TrimExternalBracketsFromWebLink(const CFX_WideString& str,
+FX_STRSIZE TrimExternalBracketsFromWebLink(const WideString& str,
FX_STRSIZE start,
FX_STRSIZE end) {
for (FX_STRSIZE pos = 0; pos < start; pos++) {
@@ -144,7 +144,7 @@ void CPDF_LinkExtract::ParseLink() {
pos++;
continue;
}
- CFX_WideString strBeCheck;
+ WideString strBeCheck;
strBeCheck = m_pTextPage->GetPageText(start, nCount);
if (bLineBreak) {
strBeCheck.Remove(TEXT_LINEFEED_CHAR);
@@ -187,7 +187,7 @@ void CPDF_LinkExtract::ParseLink() {
}
}
-bool CPDF_LinkExtract::CheckWebLink(CFX_WideString* strBeCheck,
+bool CPDF_LinkExtract::CheckWebLink(WideString* strBeCheck,
int32_t* nStart,
int32_t* nCount) {
static const wchar_t kHttpScheme[] = L"http";
@@ -195,7 +195,7 @@ bool CPDF_LinkExtract::CheckWebLink(CFX_WideString* strBeCheck,
static const wchar_t kWWWAddrStart[] = L"www.";
static const FX_STRSIZE kWWWAddrStartLen = FXSYS_len(kWWWAddrStart);
- CFX_WideString str = *strBeCheck;
+ WideString str = *strBeCheck;
str.MakeLower();
FX_STRSIZE len = str.GetLength();
@@ -237,7 +237,7 @@ bool CPDF_LinkExtract::CheckWebLink(CFX_WideString* strBeCheck,
return false;
}
-bool CPDF_LinkExtract::CheckMailLink(CFX_WideString* str) {
+bool CPDF_LinkExtract::CheckMailLink(WideString* str) {
auto aPos = str->Find(L'@');
// Invalid when no '@' or when starts/ends with '@'.
if (!aPos.has_value() || aPos.value() == 0 || aPos == str->GetLength() - 1)
@@ -305,7 +305,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString* str) {
return true;
}
-CFX_WideString CPDF_LinkExtract::GetURL(size_t index) const {
+WideString CPDF_LinkExtract::GetURL(size_t index) const {
return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L"";
}
diff --git a/core/fpdftext/cpdf_linkextract.h b/core/fpdftext/cpdf_linkextract.h
index 5c022d3d78..db82deb684 100644
--- a/core/fpdftext/cpdf_linkextract.h
+++ b/core/fpdftext/cpdf_linkextract.h
@@ -22,23 +22,23 @@ class CPDF_LinkExtract {
void ExtractLinks();
size_t CountLinks() const { return m_LinkArray.size(); }
- CFX_WideString GetURL(size_t index) const;
+ WideString GetURL(size_t index) const;
std::vector<CFX_FloatRect> GetRects(size_t index) const;
protected:
void ParseLink();
- bool CheckWebLink(CFX_WideString* str, int32_t* nStart, int32_t* nCount);
- bool CheckMailLink(CFX_WideString* str);
+ bool CheckWebLink(WideString* str, int32_t* nStart, int32_t* nCount);
+ bool CheckMailLink(WideString* str);
private:
struct Link {
int m_Start;
int m_Count;
- CFX_WideString m_strUrl;
+ WideString m_strUrl;
};
CFX_UnownedPtr<const CPDF_TextPage> const m_pTextPage;
- CFX_WideString m_strPageText;
+ WideString m_strPageText;
std::vector<Link> m_LinkArray;
};
diff --git a/core/fpdftext/cpdf_linkextract_unittest.cpp b/core/fpdftext/cpdf_linkextract_unittest.cpp
index efeb53ebe2..30438e6c10 100644
--- a/core/fpdftext/cpdf_linkextract_unittest.cpp
+++ b/core/fpdftext/cpdf_linkextract_unittest.cpp
@@ -32,7 +32,7 @@ TEST(CPDF_LinkExtractTest, CheckMailLink) {
};
for (size_t i = 0; i < FX_ArraySize(invalid_strs); ++i) {
const wchar_t* const input = invalid_strs[i];
- CFX_WideString text_str(input);
+ WideString text_str(input);
EXPECT_FALSE(extractor.CheckMailLink(&text_str)) << input;
}
@@ -53,8 +53,8 @@ TEST(CPDF_LinkExtractTest, CheckMailLink) {
};
for (size_t i = 0; i < FX_ArraySize(valid_strs); ++i) {
const wchar_t* const input = valid_strs[i][0];
- CFX_WideString text_str(input);
- CFX_WideString expected_str(L"mailto:");
+ WideString text_str(input);
+ WideString expected_str(L"mailto:");
expected_str += valid_strs[i][1];
EXPECT_TRUE(extractor.CheckMailLink(&text_str)) << input;
EXPECT_STREQ(expected_str.c_str(), text_str.c_str());
@@ -80,7 +80,7 @@ TEST(CPDF_LinkExtractTest, CheckWebLink) {
const int32_t DEFAULT_VALUE = -42;
for (size_t i = 0; i < FX_ArraySize(invalid_cases); ++i) {
const wchar_t* const input = invalid_cases[i];
- CFX_WideString text_str(input);
+ WideString text_str(input);
int32_t start_offset = DEFAULT_VALUE;
int32_t count = DEFAULT_VALUE;
EXPECT_FALSE(extractor.CheckWebLink(&text_str, &start_offset, &count))
@@ -175,7 +175,7 @@ TEST(CPDF_LinkExtractTest, CheckWebLink) {
};
for (size_t i = 0; i < FX_ArraySize(valid_cases); ++i) {
const wchar_t* const input = valid_cases[i].input_string;
- CFX_WideString text_str(input);
+ WideString text_str(input);
int32_t start_offset = DEFAULT_VALUE;
int32_t count = DEFAULT_VALUE;
EXPECT_TRUE(extractor.CheckWebLink(&text_str, &start_offset, &count))
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index ee1d51bfd8..f73793cd72 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -348,14 +348,14 @@ int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point,
return pos < pdfium::CollectionSize<int>(m_CharList) ? pos : NearPos;
}
-CFX_WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
+WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
if (!m_bIsParsed)
- return CFX_WideString();
+ return WideString();
float posy = 0;
bool IsContainPreChar = false;
bool IsAddLineFeed = false;
- CFX_WideString strText;
+ WideString strText;
for (const auto& charinfo : m_CharList) {
if (IsRectIntersect(rect, charinfo.m_CharBox)) {
if (fabs(posy - charinfo.m_Origin.y) > 0 && !IsContainPreChar &&
@@ -436,7 +436,7 @@ void CPDF_TextPage::CheckMarkedContentObject(int32_t& start,
}
}
-CFX_WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
+WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
if (!m_bIsParsed || nCount == 0)
return L"";
@@ -445,8 +445,8 @@ CFX_WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
if (nCount == -1) {
nCount = pdfium::CollectionSize<int>(m_CharList) - start;
- CFX_WideStringC wsTextBuf = m_TextBuf.AsStringC();
- return CFX_WideString(wsTextBuf.Right(wsTextBuf.GetLength() - start));
+ WideStringView wsTextBuf = m_TextBuf.AsStringView();
+ return WideString(wsTextBuf.Right(wsTextBuf.GetLength() - start));
}
if (nCount <= 0 || m_CharList.empty())
return L"";
@@ -478,7 +478,7 @@ CFX_WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
nCount = start + nCount - nCountOffset - startindex;
if (nCount <= 0)
return L"";
- return CFX_WideString(m_TextBuf.AsStringC().Mid(startindex, nCount));
+ return WideString(m_TextBuf.AsStringView().Mid(startindex, nCount));
}
int CPDF_TextPage::CountRects(int start, int nCount) {
@@ -630,7 +630,7 @@ int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const {
if (int w = pFont->GetCharWidthF(charCode))
return w;
- CFX_ByteString str;
+ ByteString str;
pFont->AppendChar(&str, charCode);
if (int w = pFont->GetStringWidth(str.c_str(), 1))
return w;
@@ -702,7 +702,7 @@ void CPDF_TextPage::CloseTempLine() {
if (m_TempCharList.empty())
return;
- CFX_WideString str = m_TempTextBuf.MakeString();
+ WideString str = m_TempTextBuf.MakeString();
bool bPrevSpace = false;
for (FX_STRSIZE i = 0; i < str.GetLength(); i++) {
if (str[i] != ' ') {
@@ -814,7 +814,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
if (nContentMark < 1)
return FPDFText_MarkedContent::Pass;
- CFX_WideString actText;
+ WideString actText;
bool bExist = false;
CPDF_Dictionary* pDict = nullptr;
int n = 0;
@@ -876,7 +876,7 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
if (nContentMark < 1)
return;
- CFX_WideString actText;
+ WideString actText;
for (int n = 0; n < nContentMark; n++) {
const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(n);
CPDF_Dictionary* pDict = item.GetParam();
@@ -941,13 +941,13 @@ void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend,
bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
const CPDF_Font* pFont,
int nItems) const {
- CFX_WideString str;
+ WideString str;
for (int32_t i = 0; i < nItems; i++) {
CPDF_TextObjectItem item;
pTextObj->GetItemInfo(i, &item);
if (item.m_CharCode == static_cast<uint32_t>(-1))
continue;
- CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
+ WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
wchar_t wChar = !wstrItem.IsEmpty() ? wstrItem[0] : 0;
if (wChar == 0)
wChar = item.m_CharCode;
@@ -1004,7 +1004,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
if (pTextObj->CountChars() == 1) {
CPDF_TextObjectItem item;
pTextObj->GetCharInfo(0, &item);
- CFX_WideString wstrItem =
+ WideString wstrItem =
pTextObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
wstrItem += (wchar_t)item.m_CharCode;
@@ -1013,7 +1013,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
return;
}
while (m_TempTextBuf.GetSize() > 0 &&
- m_TempTextBuf.AsStringC()[m_TempTextBuf.GetLength() - 1] ==
+ m_TempTextBuf.AsStringView()[m_TempTextBuf.GetLength() - 1] ==
0x20) {
m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
m_TempCharList.pop_back();
@@ -1053,9 +1053,9 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
PAGECHAR_INFO charinfo;
pTextObj->GetItemInfo(i, &item);
if (item.m_CharCode == static_cast<uint32_t>(-1)) {
- CFX_WideString str = m_TempTextBuf.MakeString();
+ WideString str = m_TempTextBuf.MakeString();
if (str.IsEmpty())
- str = m_TextBuf.AsStringC();
+ str = m_TextBuf.AsStringView();
if (str.IsEmpty() || str[str.GetLength() - 1] == TEXT_SPACE_CHAR)
continue;
@@ -1106,7 +1106,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
continue;
}
spacing = 0;
- CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
+ WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
bool bNoUnicode = false;
if (wstrItem.IsEmpty() && item.m_CharCode) {
wstrItem += static_cast<wchar_t>(item.m_CharCode);
@@ -1177,7 +1177,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
m_TempCharList.push_back(charinfo);
}
} else if (i == 0) {
- CFX_WideString str = m_TempTextBuf.MakeString();
+ WideString str = m_TempTextBuf.MakeString();
if (!str.IsEmpty() && str[str.GetLength() - 1] == TEXT_SPACE_CHAR) {
m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
m_TempCharList.pop_back();
@@ -1220,11 +1220,11 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode(
}
bool CPDF_TextPage::IsHyphen(wchar_t curChar) const {
- CFX_WideStringC curText;
+ WideStringView curText;
if (!m_TempTextBuf.IsEmpty())
- curText = m_TempTextBuf.AsStringC();
+ curText = m_TempTextBuf.AsStringView();
else if (!m_TextBuf.IsEmpty())
- curText = m_TextBuf.AsStringC();
+ curText = m_TextBuf.AsStringView();
else
return false;
@@ -1267,8 +1267,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
int nItem = m_pPreTextObj->CountItems();
m_pPreTextObj->GetItemInfo(nItem - 1, &PrevItem);
pObj->GetItemInfo(0, &item);
- CFX_WideString wstrItem =
- pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
+ WideString wstrItem = pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
wstrItem += static_cast<wchar_t>(item.m_CharCode);
wchar_t curChar = wstrItem[0];
@@ -1356,7 +1355,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
IsHyphen(curChar)) {
return GenerateCharacter::Hyphen;
}
- CFX_WideString PrevStr =
+ WideString PrevStr =
m_pPreTextObj->GetFont()->UnicodeFromCharCode(PrevItem.m_CharCode);
if (PrevStr.IsEmpty())
return GenerateCharacter::None;
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index 41892ea97c..ef55ad05cb 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -106,8 +106,8 @@ class CPDF_TextPage {
void GetCharInfo(int index, FPDF_CHAR_INFO* info) const;
std::vector<CFX_FloatRect> GetRectArray(int start, int nCount) const;
int GetIndexAtPos(const CFX_PointF& point, const CFX_SizeF& tolerance) const;
- CFX_WideString GetTextByRect(const CFX_FloatRect& rect) const;
- CFX_WideString GetPageText(int start = 0, int nCount = -1) const;
+ WideString GetTextByRect(const CFX_FloatRect& rect) const;
+ WideString GetPageText(int start = 0, int nCount = -1) const;
int CountRects(int start, int nCount);
void GetRect(int rectIndex,
float& left,
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 3678e42515..f00b8a9f4d 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -79,14 +79,14 @@ int CPDF_TextPageFind::GetCharIndex(int index) const {
return m_pTextPage->CharIndexFromTextIndex(index);
}
-bool CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat,
+bool CPDF_TextPageFind::FindFirst(const WideString& findwhat,
int flags,
pdfium::Optional<FX_STRSIZE> startPos) {
if (!m_pTextPage)
return false;
if (m_strText.IsEmpty() || m_bMatchCase != (flags & FPDFTEXT_MATCHCASE))
m_strText = m_pTextPage->GetPageText();
- CFX_WideString findwhatStr = findwhat;
+ WideString findwhatStr = findwhat;
m_findWhat = findwhatStr;
m_flags = flags;
m_bMatchCase = flags & FPDFTEXT_MATCHCASE;
@@ -147,7 +147,7 @@ bool CPDF_TextPageFind::FindNext() {
FX_STRSIZE nStartPos = m_findNextStart.value();
bool bSpaceStart = false;
for (int iWord = 0; iWord < nCount; iWord++) {
- CFX_WideString csWord = m_csFindWhatArray[iWord];
+ WideString csWord = m_csFindWhatArray[iWord];
if (csWord.IsEmpty()) {
if (iWord == nCount - 1) {
wchar_t strInsert = m_strText[nStartPos];
@@ -175,7 +175,7 @@ bool CPDF_TextPageFind::FindNext() {
if (iWord != 0 && !bSpaceStart) {
FX_STRSIZE PreResEndPos = nStartPos;
int curChar = csWord[0];
- CFX_WideString lastWord = m_csFindWhatArray[iWord - 1];
+ WideString lastWord = m_csFindWhatArray[iWord - 1];
int lastChar = lastWord[lastWord.GetLength() - 1];
if (nStartPos == nResultPos.value() &&
!(IsIgnoreSpaceCharacter(lastChar) ||
@@ -275,12 +275,12 @@ bool CPDF_TextPageFind::FindPrev() {
return m_IsFind;
}
-void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
+void CPDF_TextPageFind::ExtractFindWhat(const WideString& findwhat) {
if (findwhat.IsEmpty())
return;
int index = 0;
while (1) {
- CFX_WideString csWord = TEXT_EMPTY;
+ WideString csWord = TEXT_EMPTY;
int ret =
ExtractSubString(csWord, findwhat.c_str(), index, TEXT_SPACE_CHAR);
if (csWord.IsEmpty()) {
@@ -294,7 +294,7 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
}
FX_STRSIZE pos = 0;
while (pos < csWord.GetLength()) {
- CFX_WideString curStr = csWord.Mid(pos, 1);
+ WideString curStr = csWord.Mid(pos, 1);
wchar_t curChar = csWord[pos];
if (IsIgnoreSpaceCharacter(curChar)) {
if (pos > 0 && curChar == 0x2019) {
@@ -320,7 +320,7 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
}
}
-bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
+bool CPDF_TextPageFind::IsMatchWholeWord(const WideString& csPageText,
FX_STRSIZE startPos,
FX_STRSIZE endPos) {
if (startPos > endPos)
@@ -360,7 +360,7 @@ bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
return true;
}
-bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
+bool CPDF_TextPageFind::ExtractSubString(WideString& rString,
const wchar_t* lpszFullString,
int iSubString,
wchar_t chSep) {
diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h
index cf8d3d1702..f9a28a0b0a 100644
--- a/core/fpdftext/cpdf_textpagefind.h
+++ b/core/fpdftext/cpdf_textpagefind.h
@@ -22,7 +22,7 @@ class CPDF_TextPageFind {
explicit CPDF_TextPageFind(const CPDF_TextPage* pTextPage);
~CPDF_TextPageFind();
- bool FindFirst(const CFX_WideString& findwhat,
+ bool FindFirst(const WideString& findwhat,
int flags,
pdfium::Optional<FX_STRSIZE> startPos);
bool FindNext();
@@ -31,11 +31,11 @@ class CPDF_TextPageFind {
int GetMatchedCount() const;
protected:
- void ExtractFindWhat(const CFX_WideString& findwhat);
- bool IsMatchWholeWord(const CFX_WideString& csPageText,
+ void ExtractFindWhat(const WideString& findwhat);
+ bool IsMatchWholeWord(const WideString& csPageText,
FX_STRSIZE startPos,
FX_STRSIZE endPos);
- bool ExtractSubString(CFX_WideString& rString,
+ bool ExtractSubString(WideString& rString,
const wchar_t* lpszFullString,
int iSubString,
wchar_t chSep);
@@ -44,10 +44,10 @@ class CPDF_TextPageFind {
private:
std::vector<uint16_t> m_CharIndex;
CFX_UnownedPtr<const CPDF_TextPage> m_pTextPage;
- CFX_WideString m_strText;
- CFX_WideString m_findWhat;
+ WideString m_strText;
+ WideString m_findWhat;
int m_flags;
- std::vector<CFX_WideString> m_csFindWhatArray;
+ std::vector<WideString> m_csFindWhatArray;
pdfium::Optional<FX_STRSIZE> m_findNextStart;
pdfium::Optional<FX_STRSIZE> m_findPreStart;
bool m_bMatchCase;
diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp
index 757019314d..f7e3546a8f 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.cpp
+++ b/core/fxcodec/codec/ccodec_gifmodule.cpp
@@ -71,7 +71,7 @@ GifDecodeStatus CCodec_GifModule::LoadFrame(Context* pContext,
if (len > 21) {
uint8_t size = *buf++;
if (size != 0)
- pAttribute->m_strAuthor = CFX_ByteString(buf, size);
+ pAttribute->m_strAuthor = ByteString(buf, size);
else
pAttribute->m_strAuthor.clear();
}
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
index 8a3de3a154..ae70389ced 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -86,8 +86,8 @@ static void _png_load_bmp_attribute(png_structp png_ptr,
buf = "Author";
if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
pAttribute->m_strAuthor =
- CFX_ByteString(reinterpret_cast<uint8_t*>(text[i].text),
- static_cast<FX_STRSIZE>(text[i].text_length));
+ ByteString(reinterpret_cast<uint8_t*>(text[i].text),
+ static_cast<FX_STRSIZE>(text[i].text_length));
}
}
}
diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h
index 2e83319ef7..926a884efe 100644
--- a/core/fxcodec/fx_codec.h
+++ b/core/fxcodec/fx_codec.h
@@ -48,7 +48,7 @@ class CFX_DIBAttribute {
int32_t m_nYDPI;
float m_fAspectRatio;
uint16_t m_wDPIUnit;
- CFX_ByteString m_strAuthor;
+ ByteString m_strAuthor;
int32_t m_nGifLeft;
int32_t m_nGifTop;
uint32_t* m_pGifLocalPalette;
diff --git a/core/fxcodec/lgif/cgifcontext.h b/core/fxcodec/lgif/cgifcontext.h
index 1bd6d46d31..03976a7aad 100644
--- a/core/fxcodec/lgif/cgifcontext.h
+++ b/core/fxcodec/lgif/cgifcontext.h
@@ -46,7 +46,7 @@ class CGifContext : public CCodec_GifModule::Context {
uint32_t avail_in;
int32_t decode_status;
uint32_t skip_size;
- CFX_ByteString cmt_data;
+ ByteString cmt_data;
std::unique_ptr<GifGCE> m_GifGCE;
uint8_t* next_in;
std::vector<std::unique_ptr<GifImage>> m_Images;
diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp
index cef4f9a9a5..18385c3bdd 100644
--- a/core/fxcodec/lgif/fx_gif.cpp
+++ b/core/fxcodec/lgif/fx_gif.cpp
@@ -61,7 +61,7 @@ GifDecodeStatus gif_decode_extension(CGifContext* context) {
context->skip_size = skip_size_org;
return GifDecodeStatus::Unfinished;
}
- context->cmt_data += CFX_ByteString(data_ptr, data_size);
+ context->cmt_data += ByteString(data_ptr, data_size);
}
break;
}
diff --git a/core/fxcrt/cfx_bytestring.cpp b/core/fxcrt/bytestring.cpp
index 073591a5ab..dd4dbd99e2 100644
--- a/core/fxcrt/cfx_bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcrt/cfx_bytestring.h"
+#include "core/fxcrt/bytestring.h"
#include <stddef.h>
@@ -21,9 +21,9 @@
#include "third_party/base/stl_util.h"
template class CFX_StringDataTemplate<char>;
-template class CFX_StringCTemplate<char>;
-template class CFX_StringPoolTemplate<CFX_ByteString>;
-template struct std::hash<CFX_ByteString>;
+template class fxcrt::StringViewTemplate<char>;
+template class CFX_StringPoolTemplate<ByteString>;
+template struct std::hash<ByteString>;
namespace {
@@ -66,7 +66,7 @@ bool IsValidCodePage(uint16_t codepage) {
}
#endif
-CFX_ByteString GetByteString(uint16_t codepage, const CFX_WideStringC& wstr) {
+ByteString GetByteString(uint16_t codepage, const WideStringView& wstr) {
ASSERT(IsValidCodePage(codepage));
int src_len = wstr.GetLength();
@@ -74,9 +74,9 @@ CFX_ByteString GetByteString(uint16_t codepage, const CFX_WideStringC& wstr) {
FXSYS_WideCharToMultiByte(codepage, 0, wstr.unterminated_c_str(), src_len,
nullptr, 0, nullptr, nullptr);
if (!dest_len)
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString bstr;
+ ByteString bstr;
char* dest_buf = bstr.GetBuffer(dest_len);
FXSYS_WideCharToMultiByte(codepage, 0, wstr.unterminated_c_str(), src_len,
dest_buf, dest_len, nullptr, nullptr);
@@ -86,45 +86,45 @@ CFX_ByteString GetByteString(uint16_t codepage, const CFX_WideStringC& wstr) {
} // namespace
-static_assert(sizeof(CFX_ByteString) <= sizeof(char*),
+namespace fxcrt {
+
+static_assert(sizeof(ByteString) <= sizeof(char*),
"Strings must not require more space than pointers");
-CFX_ByteString::CFX_ByteString(const char* pStr, FX_STRSIZE nLen) {
+ByteString::ByteString(const char* pStr, FX_STRSIZE nLen) {
if (nLen)
m_pData.Reset(StringData::Create(pStr, nLen));
}
-CFX_ByteString::CFX_ByteString(const uint8_t* pStr, FX_STRSIZE nLen) {
+ByteString::ByteString(const uint8_t* pStr, FX_STRSIZE nLen) {
if (nLen)
m_pData.Reset(
StringData::Create(reinterpret_cast<const char*>(pStr), nLen));
}
-CFX_ByteString::CFX_ByteString() {}
+ByteString::ByteString() {}
-CFX_ByteString::CFX_ByteString(const CFX_ByteString& other)
- : m_pData(other.m_pData) {}
+ByteString::ByteString(const ByteString& other) : m_pData(other.m_pData) {}
-CFX_ByteString::CFX_ByteString(CFX_ByteString&& other) noexcept {
+ByteString::ByteString(ByteString&& other) noexcept {
m_pData.Swap(other.m_pData);
}
-CFX_ByteString::CFX_ByteString(char ch) {
+ByteString::ByteString(char ch) {
m_pData.Reset(StringData::Create(1));
m_pData->m_String[0] = ch;
}
-CFX_ByteString::CFX_ByteString(const char* ptr)
- : CFX_ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {}
+ByteString::ByteString(const char* ptr)
+ : ByteString(ptr, ptr ? FXSYS_strlen(ptr) : 0) {}
-CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) {
+ByteString::ByteString(const ByteStringView& stringSrc) {
if (!stringSrc.IsEmpty())
m_pData.Reset(StringData::Create(stringSrc.unterminated_c_str(),
stringSrc.GetLength()));
}
-CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1,
- const CFX_ByteStringC& str2) {
+ByteString::ByteString(const ByteStringView& str1, const ByteStringView& str2) {
FX_SAFE_STRSIZE nSafeLen = str1.GetLength();
nSafeLen += str2.GetLength();
@@ -138,8 +138,7 @@ CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1,
str2.GetLength());
}
-CFX_ByteString::CFX_ByteString(
- const std::initializer_list<CFX_ByteStringC>& list) {
+ByteString::ByteString(const std::initializer_list<ByteStringView>& list) {
FX_SAFE_STRSIZE nSafeLen = 0;
for (const auto& item : list)
nSafeLen += item.GetLength();
@@ -158,15 +157,15 @@ CFX_ByteString::CFX_ByteString(
}
}
-CFX_ByteString::CFX_ByteString(const std::ostringstream& outStream) {
+ByteString::ByteString(const std::ostringstream& outStream) {
std::string str = outStream.str();
if (str.length() > 0)
m_pData.Reset(StringData::Create(str.c_str(), str.length()));
}
-CFX_ByteString::~CFX_ByteString() {}
+ByteString::~ByteString() {}
-const CFX_ByteString& CFX_ByteString::operator=(const char* pStr) {
+const ByteString& ByteString::operator=(const char* pStr) {
if (!pStr || !pStr[0])
clear();
else
@@ -175,8 +174,7 @@ const CFX_ByteString& CFX_ByteString::operator=(const char* pStr) {
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator=(
- const CFX_ByteStringC& stringSrc) {
+const ByteString& ByteString::operator=(const ByteStringView& stringSrc) {
if (stringSrc.IsEmpty())
clear();
else
@@ -185,41 +183,40 @@ const CFX_ByteString& CFX_ByteString::operator=(
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator=(
- const CFX_ByteString& stringSrc) {
+const ByteString& ByteString::operator=(const ByteString& stringSrc) {
if (m_pData != stringSrc.m_pData)
m_pData = stringSrc.m_pData;
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator+=(const char* pStr) {
+const ByteString& ByteString::operator+=(const char* pStr) {
if (pStr)
Concat(pStr, FXSYS_strlen(pStr));
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator+=(char ch) {
+const ByteString& ByteString::operator+=(char ch) {
Concat(&ch, 1);
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteString& str) {
+const ByteString& ByteString::operator+=(const ByteString& str) {
if (str.m_pData)
Concat(str.m_pData->m_String, str.m_pData->m_nDataLength);
return *this;
}
-const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) {
+const ByteString& ByteString::operator+=(const ByteStringView& str) {
if (!str.IsEmpty())
Concat(str.unterminated_c_str(), str.GetLength());
return *this;
}
-bool CFX_ByteString::operator==(const char* ptr) const {
+bool ByteString::operator==(const char* ptr) const {
if (!m_pData)
return !ptr || !ptr[0];
@@ -230,7 +227,7 @@ bool CFX_ByteString::operator==(const char* ptr) const {
memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
}
-bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
+bool ByteString::operator==(const ByteStringView& str) const {
if (!m_pData)
return str.IsEmpty();
@@ -239,7 +236,7 @@ bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
0;
}
-bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
+bool ByteString::operator==(const ByteString& other) const {
if (m_pData == other.m_pData)
return true;
@@ -254,7 +251,7 @@ bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
m_pData->m_nDataLength) == 0;
}
-bool CFX_ByteString::operator<(const CFX_ByteString& str) const {
+bool ByteString::operator<(const ByteString& str) const {
if (m_pData == str.m_pData)
return false;
@@ -263,7 +260,7 @@ bool CFX_ByteString::operator<(const CFX_ByteString& str) const {
return result < 0 || (result == 0 && GetLength() < str.GetLength());
}
-bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const {
+bool ByteString::EqualNoCase(const ByteStringView& str) const {
if (!m_pData)
return str.IsEmpty();
@@ -286,13 +283,13 @@ bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const {
return true;
}
-void CFX_ByteString::AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen) {
+void ByteString::AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen) {
AllocBeforeWrite(nSrcLen);
m_pData->CopyContents(pSrcData, nSrcLen);
m_pData->m_nDataLength = nSrcLen;
}
-void CFX_ByteString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
+void ByteString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
if (m_pData && m_pData->CanOperateInPlace(nNewLength))
return;
@@ -313,7 +310,7 @@ void CFX_ByteString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
m_pData.Swap(pNewData);
}
-void CFX_ByteString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
+void ByteString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
if (m_pData && m_pData->CanOperateInPlace(nNewLength))
return;
@@ -325,7 +322,7 @@ void CFX_ByteString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
m_pData.Reset(StringData::Create(nNewLength));
}
-void CFX_ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) {
+void ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) {
if (!m_pData)
return;
@@ -341,16 +338,16 @@ void CFX_ByteString::ReleaseBuffer(FX_STRSIZE nNewLength) {
if (m_pData->m_nAllocLength - nNewLength >= 32) {
// Over arbitrary threshold, so pay the price to relocate. Force copy to
// always occur by holding a second reference to the string.
- CFX_ByteString preserve(*this);
+ ByteString preserve(*this);
ReallocBeforeWrite(nNewLength);
}
}
-void CFX_ByteString::Reserve(FX_STRSIZE len) {
+void ByteString::Reserve(FX_STRSIZE len) {
GetBuffer(len);
}
-char* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) {
+char* ByteString::GetBuffer(FX_STRSIZE nMinBufLength) {
if (!m_pData) {
if (nMinBufLength == 0)
return nullptr;
@@ -375,7 +372,7 @@ char* CFX_ByteString::GetBuffer(FX_STRSIZE nMinBufLength) {
return m_pData->m_String;
}
-FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
+FX_STRSIZE ByteString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
if (!m_pData)
return 0;
@@ -396,7 +393,7 @@ FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
return m_pData->m_nDataLength;
}
-void CFX_ByteString::Concat(const char* pSrcData, FX_STRSIZE nSrcLen) {
+void ByteString::Concat(const char* pSrcData, FX_STRSIZE nSrcLen) {
if (!pSrcData || nSrcLen == 0)
return;
@@ -418,42 +415,42 @@ void CFX_ByteString::Concat(const char* pSrcData, FX_STRSIZE nSrcLen) {
m_pData.Swap(pNewData);
}
-CFX_ByteString CFX_ByteString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
+ByteString ByteString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
if (!m_pData)
- return CFX_ByteString();
+ return ByteString();
if (!IsValidIndex(first))
- return CFX_ByteString();
+ return ByteString();
if (count == 0 || !IsValidLength(count))
- return CFX_ByteString();
+ return ByteString();
if (!IsValidIndex(first + count - 1))
- return CFX_ByteString();
+ return ByteString();
if (first == 0 && count == m_pData->m_nDataLength)
return *this;
- CFX_ByteString dest;
+ ByteString dest;
AllocCopy(dest, count, first);
return dest;
}
-CFX_ByteString CFX_ByteString::Left(FX_STRSIZE count) const {
+ByteString ByteString::Left(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_ByteString();
+ return ByteString();
return Mid(0, count);
}
-CFX_ByteString CFX_ByteString::Right(FX_STRSIZE count) const {
+ByteString ByteString::Right(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_ByteString();
+ return ByteString();
return Mid(GetLength() - count, count);
}
-void CFX_ByteString::AllocCopy(CFX_ByteString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const {
+void ByteString::AllocCopy(ByteString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const {
if (nCopyLen == 0)
return;
@@ -466,13 +463,13 @@ void CFX_ByteString::AllocCopy(CFX_ByteString& dest,
#define FORCE_UNICODE 0x20000
#define FORCE_INT64 0x40000
-CFX_ByteString CFX_ByteString::FormatInteger(int i) {
+ByteString ByteString::FormatInteger(int i) {
char buf[32];
FXSYS_snprintf(buf, 32, "%d", i);
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
-void CFX_ByteString::FormatV(const char* pFormat, va_list argList) {
+void ByteString::FormatV(const char* pFormat, va_list argList) {
va_list argListCopy;
va_copy(argListCopy, argList);
FX_STRSIZE nMaxLen = vsnprintf(nullptr, 0, pFormat, argListCopy);
@@ -491,20 +488,20 @@ void CFX_ByteString::FormatV(const char* pFormat, va_list argList) {
}
}
-void CFX_ByteString::Format(const char* pFormat, ...) {
+void ByteString::Format(const char* pFormat, ...) {
va_list argList;
va_start(argList, pFormat);
FormatV(pFormat, argList);
va_end(argList);
}
-void CFX_ByteString::SetAt(FX_STRSIZE index, char c) {
+void ByteString::SetAt(FX_STRSIZE index, char c) {
ASSERT(IsValidIndex(index));
ReallocBeforeWrite(m_pData->m_nDataLength);
m_pData->m_String[index] = c;
}
-FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE location, char ch) {
+FX_STRSIZE ByteString::Insert(FX_STRSIZE location, char ch) {
const FX_STRSIZE cur_length = m_pData ? m_pData->m_nDataLength : 0;
if (!IsValidLength(location))
return cur_length;
@@ -518,8 +515,7 @@ FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE location, char ch) {
return new_length;
}
-pdfium::Optional<FX_STRSIZE> CFX_ByteString::Find(char ch,
- FX_STRSIZE start) const {
+pdfium::Optional<FX_STRSIZE> ByteString::Find(char ch, FX_STRSIZE start) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -533,8 +529,8 @@ pdfium::Optional<FX_STRSIZE> CFX_ByteString::Find(char ch,
: pdfium::Optional<FX_STRSIZE>();
}
-pdfium::Optional<FX_STRSIZE> CFX_ByteString::Find(const CFX_ByteStringC& subStr,
- FX_STRSIZE start) const {
+pdfium::Optional<FX_STRSIZE> ByteString::Find(const ByteStringView& subStr,
+ FX_STRSIZE start) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -549,7 +545,7 @@ pdfium::Optional<FX_STRSIZE> CFX_ByteString::Find(const CFX_ByteStringC& subStr,
: pdfium::Optional<FX_STRSIZE>();
}
-pdfium::Optional<FX_STRSIZE> CFX_ByteString::ReverseFind(char ch) const {
+pdfium::Optional<FX_STRSIZE> ByteString::ReverseFind(char ch) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -561,7 +557,7 @@ pdfium::Optional<FX_STRSIZE> CFX_ByteString::ReverseFind(char ch) const {
return pdfium::Optional<FX_STRSIZE>();
}
-void CFX_ByteString::MakeLower() {
+void ByteString::MakeLower() {
if (!m_pData)
return;
@@ -569,7 +565,7 @@ void CFX_ByteString::MakeLower() {
FXSYS_strlwr(m_pData->m_String);
}
-void CFX_ByteString::MakeUpper() {
+void ByteString::MakeUpper() {
if (!m_pData)
return;
@@ -577,7 +573,7 @@ void CFX_ByteString::MakeUpper() {
FXSYS_strupr(m_pData->m_String);
}
-FX_STRSIZE CFX_ByteString::Remove(char chRemove) {
+FX_STRSIZE ByteString::Remove(char chRemove) {
if (!m_pData || m_pData->m_nDataLength < 1)
return 0;
@@ -611,8 +607,8 @@ FX_STRSIZE CFX_ByteString::Remove(char chRemove) {
return nCount;
}
-FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld,
- const CFX_ByteStringC& pNew) {
+FX_STRSIZE ByteString::Replace(const ByteStringView& pOld,
+ const ByteStringView& pNew) {
if (!m_pData || pOld.IsEmpty())
return 0;
@@ -658,20 +654,20 @@ FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld,
return nCount;
}
-CFX_WideString CFX_ByteString::UTF8Decode() const {
+WideString ByteString::UTF8Decode() const {
CFX_UTF8Decoder decoder;
for (FX_STRSIZE i = 0; i < GetLength(); i++) {
decoder.Input(static_cast<uint8_t>(m_pData->m_String[i]));
}
- return CFX_WideString(decoder.GetResult());
+ return WideString(decoder.GetResult());
}
// static
-CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) {
- return GetByteString(0, str.AsStringC());
+ByteString ByteString::FromUnicode(const WideString& str) {
+ return GetByteString(0, str.AsStringView());
}
-int CFX_ByteString::Compare(const CFX_ByteStringC& str) const {
+int ByteString::Compare(const ByteStringView& str) const {
if (!m_pData) {
return str.IsEmpty() ? 0 : -1;
}
@@ -695,7 +691,7 @@ int CFX_ByteString::Compare(const CFX_ByteStringC& str) const {
return 0;
}
-void CFX_ByteString::TrimRight(const CFX_ByteStringC& pTargets) {
+void ByteString::TrimRight(const ByteStringView& pTargets) {
if (!m_pData || pTargets.IsEmpty())
return;
@@ -721,15 +717,15 @@ void CFX_ByteString::TrimRight(const CFX_ByteStringC& pTargets) {
}
}
-void CFX_ByteString::TrimRight(char chTarget) {
- TrimRight(CFX_ByteStringC(chTarget));
+void ByteString::TrimRight(char chTarget) {
+ TrimRight(ByteStringView(chTarget));
}
-void CFX_ByteString::TrimRight() {
+void ByteString::TrimRight() {
TrimRight("\x09\x0a\x0b\x0c\x0d\x20");
}
-void CFX_ByteString::TrimLeft(const CFX_ByteStringC& pTargets) {
+void ByteString::TrimLeft(const ByteStringView& pTargets) {
if (!m_pData || pTargets.IsEmpty())
return;
@@ -757,24 +753,26 @@ void CFX_ByteString::TrimLeft(const CFX_ByteStringC& pTargets) {
}
}
-void CFX_ByteString::TrimLeft(char chTarget) {
- TrimLeft(CFX_ByteStringC(chTarget));
+void ByteString::TrimLeft(char chTarget) {
+ TrimLeft(ByteStringView(chTarget));
}
-void CFX_ByteString::TrimLeft() {
+void ByteString::TrimLeft() {
TrimLeft("\x09\x0a\x0b\x0c\x0d\x20");
}
-CFX_ByteString CFX_ByteString::FormatFloat(float d, int precision) {
+ByteString ByteString::FormatFloat(float d, int precision) {
char buf[32];
FX_STRSIZE len = FX_ftoa(d, buf);
- return CFX_ByteString(buf, len);
+ return ByteString(buf, len);
}
-std::ostream& operator<<(std::ostream& os, const CFX_ByteString& str) {
+std::ostream& operator<<(std::ostream& os, const ByteString& str) {
return os.write(str.c_str(), str.GetLength());
}
-std::ostream& operator<<(std::ostream& os, const CFX_ByteStringC& str) {
+std::ostream& operator<<(std::ostream& os, const ByteStringView& str) {
return os.write(str.unterminated_c_str(), str.GetLength());
}
+
+} // namespace fxcrt
diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h
new file mode 100644
index 0000000000..0220e707cd
--- /dev/null
+++ b/core/fxcrt/bytestring.h
@@ -0,0 +1,279 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_BYTESTRING_H_
+#define CORE_FXCRT_BYTESTRING_H_
+
+#include <functional>
+#include <iterator>
+#include <sstream>
+#include <utility>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_string_data_template.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/string_view_template.h"
+#include "third_party/base/optional.h"
+
+class ByteString_Concat_Test;
+class fxcrt_ByteStringPool_Test;
+
+namespace fxcrt {
+
+class WideString;
+
+// A mutable string with shared buffers using copy-on-write semantics that
+// avoids the cost of std::string's iterator stability guarantees.
+class ByteString {
+ public:
+ using CharType = char;
+ using const_iterator = const CharType*;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+
+ ByteString();
+ ByteString(const ByteString& other);
+ ByteString(ByteString&& other) noexcept;
+
+ // Deliberately implicit to avoid calling on every string literal.
+ // NOLINTNEXTLINE(runtime/explicit)
+ ByteString(char ch);
+ // NOLINTNEXTLINE(runtime/explicit)
+ ByteString(const char* ptr);
+
+ // No implicit conversions from wide strings.
+ // NOLINTNEXTLINE(runtime/explicit)
+ ByteString(wchar_t) = delete;
+
+ ByteString(const char* ptr, FX_STRSIZE len);
+ ByteString(const uint8_t* ptr, FX_STRSIZE len);
+
+ explicit ByteString(const ByteStringView& bstrc);
+ ByteString(const ByteStringView& bstrc1, const ByteStringView& bstrc2);
+ ByteString(const std::initializer_list<ByteStringView>& list);
+ explicit ByteString(const std::ostringstream& outStream);
+
+ ~ByteString();
+
+ void clear() { m_pData.Reset(); }
+
+ static ByteString FromUnicode(const WideString& str);
+
+ // Explicit conversion to C-style string.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ const char* c_str() const { return m_pData ? m_pData->m_String : ""; }
+
+ // Explicit conversion to uint8_t*.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ const uint8_t* raw_str() const {
+ return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
+ : nullptr;
+ }
+
+ // Explicit conversion to ByteStringView.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ ByteStringView AsStringView() const {
+ return ByteStringView(raw_str(), GetLength());
+ }
+
+ // Note: Any subsequent modification of |this| will invalidate iterators.
+ const_iterator begin() const { return m_pData ? m_pData->m_String : nullptr; }
+ const_iterator end() const {
+ return m_pData ? m_pData->m_String + m_pData->m_nDataLength : nullptr;
+ }
+
+ // Note: Any subsequent modification of |this| will invalidate iterators.
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+ FX_STRSIZE GetStringLength() const {
+ return m_pData ? FXSYS_strlen(m_pData->m_String) : 0;
+ }
+ bool IsEmpty() const { return !GetLength(); }
+ bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
+ bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
+
+ int Compare(const ByteStringView& str) const;
+ bool EqualNoCase(const ByteStringView& str) const;
+
+ bool operator==(const char* ptr) const;
+ bool operator==(const ByteStringView& str) const;
+ bool operator==(const ByteString& other) const;
+
+ bool operator!=(const char* ptr) const { return !(*this == ptr); }
+ bool operator!=(const ByteStringView& str) const { return !(*this == str); }
+ bool operator!=(const ByteString& other) const { return !(*this == other); }
+
+ bool operator<(const ByteString& str) const;
+
+ const ByteString& operator=(const char* str);
+ const ByteString& operator=(const ByteStringView& bstrc);
+ const ByteString& operator=(const ByteString& stringSrc);
+
+ const ByteString& operator+=(char ch);
+ const ByteString& operator+=(const char* str);
+ const ByteString& operator+=(const ByteString& str);
+ const ByteString& operator+=(const ByteStringView& bstrc);
+
+ CharType operator[](const FX_STRSIZE index) const {
+ ASSERT(IsValidIndex(index));
+ return m_pData ? m_pData->m_String[index] : 0;
+ }
+
+ CharType First() const { return GetLength() ? (*this)[0] : 0; }
+ CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
+
+ void SetAt(FX_STRSIZE index, char c);
+
+ FX_STRSIZE Insert(FX_STRSIZE index, char ch);
+ FX_STRSIZE InsertAtFront(char ch) { return Insert(0, ch); }
+ FX_STRSIZE InsertAtBack(char ch) { return Insert(GetLength(), ch); }
+ FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+
+ void Format(const char* lpszFormat, ...);
+ void FormatV(const char* lpszFormat, va_list argList);
+
+ void Reserve(FX_STRSIZE len);
+ char* GetBuffer(FX_STRSIZE len);
+ void ReleaseBuffer(FX_STRSIZE len);
+
+ ByteString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
+ ByteString Left(FX_STRSIZE count) const;
+ ByteString Right(FX_STRSIZE count) const;
+
+ pdfium::Optional<FX_STRSIZE> Find(const ByteStringView& lpszSub,
+ FX_STRSIZE start = 0) const;
+ pdfium::Optional<FX_STRSIZE> Find(char ch, FX_STRSIZE start = 0) const;
+ pdfium::Optional<FX_STRSIZE> ReverseFind(char ch) const;
+
+ bool Contains(const ByteStringView& lpszSub, FX_STRSIZE start = 0) const {
+ return Find(lpszSub, start).has_value();
+ }
+
+ bool Contains(char ch, FX_STRSIZE start = 0) const {
+ return Find(ch, start).has_value();
+ }
+
+ void MakeLower();
+ void MakeUpper();
+
+ void TrimRight();
+ void TrimRight(char chTarget);
+ void TrimRight(const ByteStringView& lpszTargets);
+
+ void TrimLeft();
+ void TrimLeft(char chTarget);
+ void TrimLeft(const ByteStringView& lpszTargets);
+
+ FX_STRSIZE Replace(const ByteStringView& lpszOld,
+ const ByteStringView& lpszNew);
+
+ FX_STRSIZE Remove(char ch);
+
+ WideString UTF8Decode() const;
+
+ uint32_t GetID() const { return AsStringView().GetID(); }
+
+ static ByteString FormatInteger(int i);
+ static ByteString FormatFloat(float f, int precision = 0);
+
+ protected:
+ using StringData = CFX_StringDataTemplate<char>;
+
+ void ReallocBeforeWrite(FX_STRSIZE nNewLen);
+ void AllocBeforeWrite(FX_STRSIZE nNewLen);
+ void AllocCopy(ByteString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const;
+ void AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen);
+ void Concat(const char* lpszSrcData, FX_STRSIZE nSrcLen);
+
+ CFX_RetainPtr<StringData> m_pData;
+
+ friend ByteString_Concat_Test;
+ friend fxcrt_ByteStringPool_Test;
+};
+
+inline bool operator==(const char* lhs, const ByteString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator==(const ByteStringView& lhs, const ByteString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator!=(const char* lhs, const ByteString& rhs) {
+ return rhs != lhs;
+}
+inline bool operator!=(const ByteStringView& lhs, const ByteString& rhs) {
+ return rhs != lhs;
+}
+
+inline ByteString operator+(const ByteStringView& str1,
+ const ByteStringView& str2) {
+ return ByteString(str1, str2);
+}
+inline ByteString operator+(const ByteStringView& str1, const char* str2) {
+ return ByteString(str1, str2);
+}
+inline ByteString operator+(const char* str1, const ByteStringView& str2) {
+ return ByteString(str1, str2);
+}
+inline ByteString operator+(const ByteStringView& str1, char ch) {
+ return ByteString(str1, ByteStringView(ch));
+}
+inline ByteString operator+(char ch, const ByteStringView& str2) {
+ return ByteString(ch, str2);
+}
+inline ByteString operator+(const ByteString& str1, const ByteString& str2) {
+ return ByteString(str1.AsStringView(), str2.AsStringView());
+}
+inline ByteString operator+(const ByteString& str1, char ch) {
+ return ByteString(str1.AsStringView(), ByteStringView(ch));
+}
+inline ByteString operator+(char ch, const ByteString& str2) {
+ return ByteString(ch, str2.AsStringView());
+}
+inline ByteString operator+(const ByteString& str1, const char* str2) {
+ return ByteString(str1.AsStringView(), str2);
+}
+inline ByteString operator+(const char* str1, const ByteString& str2) {
+ return ByteString(str1, str2.AsStringView());
+}
+inline ByteString operator+(const ByteString& str1,
+ const ByteStringView& str2) {
+ return ByteString(str1.AsStringView(), str2);
+}
+inline ByteString operator+(const ByteStringView& str1,
+ const ByteString& str2) {
+ return ByteString(str1, str2.AsStringView());
+}
+
+std::ostream& operator<<(std::ostream& os, const ByteString& str);
+std::ostream& operator<<(std::ostream& os, const ByteStringView& str);
+
+} // namespace fxcrt
+
+using ByteString = fxcrt::ByteString;
+
+uint32_t FX_HashCode_GetA(const ByteStringView& str, bool bIgnoreCase);
+
+namespace std {
+
+template <>
+struct hash<ByteString> {
+ std::size_t operator()(const ByteString& str) const {
+ return FX_HashCode_GetA(str.AsStringView(), false);
+ }
+};
+
+} // namespace std
+
+extern template struct std::hash<ByteString>;
+
+#endif // CORE_FXCRT_BYTESTRING_H_
diff --git a/core/fxcrt/cfx_bytestring_unittest.cpp b/core/fxcrt/bytestring_unittest.cpp
index 6bbe305268..06ba1f42fd 100644
--- a/core/fxcrt/cfx_bytestring_unittest.cpp
+++ b/core/fxcrt/bytestring_unittest.cpp
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "core/fxcrt/cfx_bytestring.h"
-#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/bytestring.h"
#include <algorithm>
#include <vector>
+#include "core/fxcrt/fx_string.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/base/stl_util.h"
-TEST(fxcrt, ByteStringElementAccess) {
- const CFX_ByteString abc("abc");
+TEST(ByteString, ElementAccess) {
+ const ByteString abc("abc");
EXPECT_EQ('a', abc[0]);
EXPECT_EQ('b', abc[1]);
EXPECT_EQ('c', abc[2]);
@@ -20,7 +20,7 @@ TEST(fxcrt, ByteStringElementAccess) {
EXPECT_DEATH({ abc[3]; }, ".*");
#endif
- CFX_ByteString mutable_abc = abc;
+ ByteString mutable_abc = abc;
EXPECT_EQ(abc.c_str(), mutable_abc.c_str());
EXPECT_EQ('a', mutable_abc[0]);
EXPECT_EQ('b', mutable_abc[1]);
@@ -48,11 +48,11 @@ TEST(fxcrt, ByteStringElementAccess) {
#endif
}
-TEST(fxcrt, ByteStringOperatorLT) {
- CFX_ByteString empty;
- CFX_ByteString a("a");
- CFX_ByteString abc("abc");
- CFX_ByteString def("def");
+TEST(ByteString, OperatorLT) {
+ ByteString empty;
+ ByteString a("a");
+ ByteString abc("abc");
+ ByteString def("def");
EXPECT_FALSE(empty < empty);
EXPECT_FALSE(a < a);
@@ -78,16 +78,16 @@ TEST(fxcrt, ByteStringOperatorLT) {
EXPECT_FALSE(def < abc);
}
-TEST(fxcrt, ByteStringOperatorEQ) {
- CFX_ByteString null_string;
+TEST(ByteString, OperatorEQ) {
+ ByteString null_string;
EXPECT_TRUE(null_string == null_string);
- CFX_ByteString empty_string("");
+ ByteString empty_string("");
EXPECT_TRUE(empty_string == empty_string);
EXPECT_TRUE(empty_string == null_string);
EXPECT_TRUE(null_string == empty_string);
- CFX_ByteString deleted_string("hello");
+ ByteString deleted_string("hello");
deleted_string.Delete(0, 5);
EXPECT_TRUE(deleted_string == deleted_string);
EXPECT_TRUE(deleted_string == null_string);
@@ -95,7 +95,7 @@ TEST(fxcrt, ByteStringOperatorEQ) {
EXPECT_TRUE(null_string == deleted_string);
EXPECT_TRUE(empty_string == deleted_string);
- CFX_ByteString byte_string("hello");
+ ByteString byte_string("hello");
EXPECT_TRUE(byte_string == byte_string);
EXPECT_FALSE(byte_string == null_string);
EXPECT_FALSE(byte_string == empty_string);
@@ -104,17 +104,17 @@ TEST(fxcrt, ByteStringOperatorEQ) {
EXPECT_FALSE(empty_string == byte_string);
EXPECT_FALSE(deleted_string == byte_string);
- CFX_ByteString byte_string_same1("hello");
+ ByteString byte_string_same1("hello");
EXPECT_TRUE(byte_string == byte_string_same1);
EXPECT_TRUE(byte_string_same1 == byte_string);
- CFX_ByteString byte_string_same2(byte_string);
+ ByteString byte_string_same2(byte_string);
EXPECT_TRUE(byte_string == byte_string_same2);
EXPECT_TRUE(byte_string_same2 == byte_string);
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
+ ByteString byte_string1("he");
+ ByteString byte_string2("hellp");
+ ByteString byte_string3("hellod");
EXPECT_FALSE(byte_string == byte_string1);
EXPECT_FALSE(byte_string == byte_string2);
EXPECT_FALSE(byte_string == byte_string3);
@@ -122,8 +122,8 @@ TEST(fxcrt, ByteStringOperatorEQ) {
EXPECT_FALSE(byte_string2 == byte_string);
EXPECT_FALSE(byte_string3 == byte_string);
- CFX_ByteStringC null_string_c;
- CFX_ByteStringC empty_string_c("");
+ ByteStringView null_string_c;
+ ByteStringView empty_string_c("");
EXPECT_TRUE(null_string == null_string_c);
EXPECT_TRUE(null_string == empty_string_c);
EXPECT_TRUE(empty_string == null_string_c);
@@ -137,13 +137,13 @@ TEST(fxcrt, ByteStringOperatorEQ) {
EXPECT_TRUE(null_string_c == deleted_string);
EXPECT_TRUE(empty_string_c == deleted_string);
- CFX_ByteStringC byte_string_c_same1("hello");
+ ByteStringView byte_string_c_same1("hello");
EXPECT_TRUE(byte_string == byte_string_c_same1);
EXPECT_TRUE(byte_string_c_same1 == byte_string);
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
+ ByteStringView byte_string_c1("he");
+ ByteStringView byte_string_c2("hellp");
+ ByteStringView byte_string_c3("hellod");
EXPECT_FALSE(byte_string == byte_string_c1);
EXPECT_FALSE(byte_string == byte_string_c2);
EXPECT_FALSE(byte_string == byte_string_c3);
@@ -181,16 +181,16 @@ TEST(fxcrt, ByteStringOperatorEQ) {
EXPECT_FALSE(c_string3 == byte_string);
}
-TEST(fxcrt, ByteStringOperatorNE) {
- CFX_ByteString null_string;
+TEST(ByteString, OperatorNE) {
+ ByteString null_string;
EXPECT_FALSE(null_string != null_string);
- CFX_ByteString empty_string("");
+ ByteString empty_string("");
EXPECT_FALSE(empty_string != empty_string);
EXPECT_FALSE(empty_string != null_string);
EXPECT_FALSE(null_string != empty_string);
- CFX_ByteString deleted_string("hello");
+ ByteString deleted_string("hello");
deleted_string.Delete(0, 5);
EXPECT_FALSE(deleted_string != deleted_string);
EXPECT_FALSE(deleted_string != null_string);
@@ -200,7 +200,7 @@ TEST(fxcrt, ByteStringOperatorNE) {
EXPECT_FALSE(empty_string != deleted_string);
EXPECT_FALSE(deleted_string != deleted_string);
- CFX_ByteString byte_string("hello");
+ ByteString byte_string("hello");
EXPECT_FALSE(byte_string != byte_string);
EXPECT_TRUE(byte_string != null_string);
EXPECT_TRUE(byte_string != empty_string);
@@ -209,17 +209,17 @@ TEST(fxcrt, ByteStringOperatorNE) {
EXPECT_TRUE(empty_string != byte_string);
EXPECT_TRUE(deleted_string != byte_string);
- CFX_ByteString byte_string_same1("hello");
+ ByteString byte_string_same1("hello");
EXPECT_FALSE(byte_string != byte_string_same1);
EXPECT_FALSE(byte_string_same1 != byte_string);
- CFX_ByteString byte_string_same2(byte_string);
+ ByteString byte_string_same2(byte_string);
EXPECT_FALSE(byte_string != byte_string_same2);
EXPECT_FALSE(byte_string_same2 != byte_string);
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
+ ByteString byte_string1("he");
+ ByteString byte_string2("hellp");
+ ByteString byte_string3("hellod");
EXPECT_TRUE(byte_string != byte_string1);
EXPECT_TRUE(byte_string != byte_string2);
EXPECT_TRUE(byte_string != byte_string3);
@@ -227,8 +227,8 @@ TEST(fxcrt, ByteStringOperatorNE) {
EXPECT_TRUE(byte_string2 != byte_string);
EXPECT_TRUE(byte_string3 != byte_string);
- CFX_ByteStringC null_string_c;
- CFX_ByteStringC empty_string_c("");
+ ByteStringView null_string_c;
+ ByteStringView empty_string_c("");
EXPECT_FALSE(null_string != null_string_c);
EXPECT_FALSE(null_string != empty_string_c);
EXPECT_FALSE(empty_string != null_string_c);
@@ -238,13 +238,13 @@ TEST(fxcrt, ByteStringOperatorNE) {
EXPECT_FALSE(null_string_c != empty_string);
EXPECT_FALSE(empty_string_c != empty_string);
- CFX_ByteStringC byte_string_c_same1("hello");
+ ByteStringView byte_string_c_same1("hello");
EXPECT_FALSE(byte_string != byte_string_c_same1);
EXPECT_FALSE(byte_string_c_same1 != byte_string);
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
+ ByteStringView byte_string_c1("he");
+ ByteStringView byte_string_c2("hellp");
+ ByteStringView byte_string_c3("hellod");
EXPECT_TRUE(byte_string != byte_string_c1);
EXPECT_TRUE(byte_string != byte_string_c2);
EXPECT_TRUE(byte_string != byte_string_c3);
@@ -282,47 +282,47 @@ TEST(fxcrt, ByteStringOperatorNE) {
EXPECT_TRUE(c_string3 != byte_string);
}
-TEST(fxcrt, ByteStringCNull) {
- CFX_ByteStringC null_string;
+TEST(ByteStringView, Null) {
+ ByteStringView null_string;
EXPECT_FALSE(null_string.raw_str());
EXPECT_EQ(0u, null_string.GetLength());
EXPECT_TRUE(null_string.IsEmpty());
- CFX_ByteStringC another_null_string;
+ ByteStringView another_null_string;
EXPECT_EQ(null_string, another_null_string);
- CFX_ByteStringC copied_null_string(null_string);
+ ByteStringView copied_null_string(null_string);
EXPECT_FALSE(copied_null_string.raw_str());
EXPECT_EQ(0u, copied_null_string.GetLength());
EXPECT_TRUE(copied_null_string.IsEmpty());
EXPECT_EQ(null_string, copied_null_string);
- CFX_ByteStringC empty_string(""); // Pointer to NUL, not NULL pointer.
+ ByteStringView empty_string(""); // Pointer to NUL, not NULL pointer.
EXPECT_TRUE(empty_string.raw_str());
EXPECT_EQ(0u, empty_string.GetLength());
EXPECT_TRUE(empty_string.IsEmpty());
EXPECT_EQ(null_string, empty_string);
- CFX_ByteStringC assigned_null_string("initially not nullptr");
+ ByteStringView assigned_null_string("initially not nullptr");
assigned_null_string = null_string;
EXPECT_FALSE(assigned_null_string.raw_str());
EXPECT_EQ(0u, assigned_null_string.GetLength());
EXPECT_TRUE(assigned_null_string.IsEmpty());
EXPECT_EQ(null_string, assigned_null_string);
- CFX_ByteStringC assigned_nullptr_string("initially not nullptr");
+ ByteStringView assigned_nullptr_string("initially not nullptr");
assigned_nullptr_string = nullptr;
EXPECT_FALSE(assigned_nullptr_string.raw_str());
EXPECT_EQ(0u, assigned_nullptr_string.GetLength());
EXPECT_TRUE(assigned_nullptr_string.IsEmpty());
EXPECT_EQ(null_string, assigned_nullptr_string);
- CFX_ByteStringC non_null_string("a");
+ ByteStringView non_null_string("a");
EXPECT_NE(null_string, non_null_string);
}
-TEST(fxcrt, ByteStringConcat) {
- CFX_ByteString fred;
+TEST(ByteString, Concat) {
+ ByteString fred;
fred.Concat("FRED", 4);
EXPECT_EQ("FRED", fred);
@@ -335,14 +335,14 @@ TEST(fxcrt, ByteStringConcat) {
fred.Concat("D", 1);
EXPECT_EQ("FRED", fred);
- CFX_ByteString copy = fred;
+ ByteString copy = fred;
fred.Concat("DY", 2);
EXPECT_EQ("FREDDY", fred);
EXPECT_EQ("FRED", copy);
}
-TEST(fxcrt, ByteStringRemove) {
- CFX_ByteString freed("FREED");
+TEST(ByteString, Remove) {
+ ByteString freed("FREED");
freed.Remove('E');
EXPECT_EQ("FRD", freed);
freed.Remove('F');
@@ -354,13 +354,13 @@ TEST(fxcrt, ByteStringRemove) {
freed.Remove('R');
EXPECT_EQ("", freed);
- CFX_ByteString empty;
+ ByteString empty;
empty.Remove('X');
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringRemoveCopies) {
- CFX_ByteString freed("FREED");
+TEST(ByteString, RemoveCopies) {
+ ByteString freed("FREED");
const char* old_buffer = freed.c_str();
// No change with single reference - no copy.
@@ -374,7 +374,7 @@ TEST(fxcrt, ByteStringRemoveCopies) {
EXPECT_EQ(old_buffer, freed.c_str());
// No change with multiple references - no copy.
- CFX_ByteString shared(freed);
+ ByteString shared(freed);
freed.Remove('Q');
EXPECT_EQ("FRD", freed);
EXPECT_EQ(old_buffer, freed.c_str());
@@ -388,8 +388,8 @@ TEST(fxcrt, ByteStringRemoveCopies) {
EXPECT_EQ(old_buffer, shared.c_str());
}
-TEST(fxcrt, ByteStringReplace) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Replace) {
+ ByteString fred("FRED");
fred.Replace("FR", "BL");
EXPECT_EQ("BLED", fred);
fred.Replace("D", "DDY");
@@ -406,8 +406,8 @@ TEST(fxcrt, ByteStringReplace) {
EXPECT_EQ("", fred);
}
-TEST(fxcrt, ByteStringInsert) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Insert) {
+ ByteString fred("FRED");
EXPECT_EQ(5u, fred.Insert(0, 'S'));
EXPECT_EQ("SFRED", fred);
EXPECT_EQ(6u, fred.Insert(1, 'T'));
@@ -419,20 +419,20 @@ TEST(fxcrt, ByteStringInsert) {
EXPECT_EQ(8u, fred.Insert(12, 'P'));
EXPECT_EQ("STFRUEDV", fred);
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(1u, empty.Insert(0, 'X'));
EXPECT_EQ("X", empty);
}
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(0u, empty.Insert(5, 'X'));
EXPECT_NE("X", empty);
}
}
-TEST(fxcrt, ByteStringInsertAtFrontAndInsertAtBack) {
+TEST(ByteString, InsertAtFrontAndInsertAtBack) {
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(1u, empty.InsertAtFront('D'));
EXPECT_EQ("D", empty);
EXPECT_EQ(2u, empty.InsertAtFront('E'));
@@ -443,7 +443,7 @@ TEST(fxcrt, ByteStringInsertAtFrontAndInsertAtBack) {
EXPECT_EQ("FRED", empty);
}
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(1u, empty.InsertAtBack('F'));
EXPECT_EQ("F", empty);
EXPECT_EQ(2u, empty.InsertAtBack('R'));
@@ -454,7 +454,7 @@ TEST(fxcrt, ByteStringInsertAtFrontAndInsertAtBack) {
EXPECT_EQ("FRED", empty);
}
{
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(1u, empty.InsertAtBack('E'));
EXPECT_EQ("E", empty);
EXPECT_EQ(2u, empty.InsertAtFront('R'));
@@ -466,8 +466,8 @@ TEST(fxcrt, ByteStringInsertAtFrontAndInsertAtBack) {
}
}
-TEST(fxcrt, ByteStringDelete) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Delete) {
+ ByteString fred("FRED");
EXPECT_EQ(4u, fred.Delete(0, 0));
EXPECT_EQ("FRED", fred);
EXPECT_EQ(2u, fred.Delete(0, 2));
@@ -479,15 +479,15 @@ TEST(fxcrt, ByteStringDelete) {
EXPECT_EQ(0u, fred.Delete(0));
EXPECT_EQ("", fred);
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ(0u, empty.Delete(0));
EXPECT_EQ("", empty);
EXPECT_EQ(0u, empty.Delete(1));
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringMid) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Mid) {
+ ByteString fred("FRED");
EXPECT_EQ("", fred.Mid(0, 0));
EXPECT_EQ("", fred.Mid(3, 0));
EXPECT_EQ("FRED", fred.Mid(0, 4));
@@ -505,12 +505,12 @@ TEST(fxcrt, ByteStringMid) {
EXPECT_EQ("RED", fred.Mid(1, 3));
EXPECT_EQ("", fred.Mid(4, 1));
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ("", empty.Mid(0, 0));
}
-TEST(fxcrt, ByteStringLeft) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Left) {
+ ByteString fred("FRED");
EXPECT_EQ("", fred.Left(0));
EXPECT_EQ("F", fred.Left(1));
EXPECT_EQ("FR", fred.Left(2));
@@ -519,13 +519,13 @@ TEST(fxcrt, ByteStringLeft) {
EXPECT_EQ("", fred.Left(5));
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ("", empty.Left(0));
EXPECT_EQ("", empty.Left(1));
}
-TEST(fxcrt, ByteStringRight) {
- CFX_ByteString fred("FRED");
+TEST(ByteString, Right) {
+ ByteString fred("FRED");
EXPECT_EQ("", fred.Right(0));
EXPECT_EQ("D", fred.Right(1));
EXPECT_EQ("ED", fred.Right(2));
@@ -534,29 +534,29 @@ TEST(fxcrt, ByteStringRight) {
EXPECT_EQ("", fred.Right(5));
- CFX_ByteString empty;
+ ByteString empty;
EXPECT_EQ("", empty.Right(0));
EXPECT_EQ("", empty.Right(1));
}
-TEST(fxcrt, ByteStringFind) {
- CFX_ByteString null_string;
+TEST(ByteString, Find) {
+ ByteString null_string;
EXPECT_FALSE(null_string.Find('a').has_value());
EXPECT_FALSE(null_string.Find('\0').has_value());
- CFX_ByteString empty_string("");
+ ByteString empty_string("");
EXPECT_FALSE(empty_string.Find('a').has_value());
EXPECT_FALSE(empty_string.Find('\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_ByteString single_string("a");
+ ByteString single_string("a");
result = single_string.Find('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.Find('b').has_value());
EXPECT_FALSE(single_string.Find('\0').has_value());
- CFX_ByteString longer_string("abccc");
+ ByteString longer_string("abccc");
result = longer_string.Find('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -580,7 +580,7 @@ TEST(fxcrt, ByteStringFind) {
EXPECT_EQ(3u, result.value());
EXPECT_FALSE(longer_string.Find("d").has_value());
- CFX_ByteString hibyte_string(
+ ByteString hibyte_string(
"ab\x8c"
"def");
result = hibyte_string.Find('\x8c');
@@ -588,24 +588,24 @@ TEST(fxcrt, ByteStringFind) {
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, ByteStringReverseFind) {
- CFX_ByteString null_string;
+TEST(ByteString, ReverseFind) {
+ ByteString null_string;
EXPECT_FALSE(null_string.ReverseFind('a').has_value());
EXPECT_FALSE(null_string.ReverseFind('\0').has_value());
- CFX_ByteString empty_string("");
+ ByteString empty_string("");
EXPECT_FALSE(empty_string.ReverseFind('a').has_value());
EXPECT_FALSE(empty_string.ReverseFind('\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_ByteString single_string("a");
+ ByteString single_string("a");
result = single_string.ReverseFind('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.ReverseFind('b').has_value());
EXPECT_FALSE(single_string.ReverseFind('\0').has_value());
- CFX_ByteString longer_string("abccc");
+ ByteString longer_string("abccc");
result = longer_string.ReverseFind('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -614,7 +614,7 @@ TEST(fxcrt, ByteStringReverseFind) {
EXPECT_EQ(4u, result.value());
EXPECT_FALSE(longer_string.ReverseFind('\0').has_value());
- CFX_ByteString hibyte_string(
+ ByteString hibyte_string(
"ab\x8c"
"def");
result = hibyte_string.ReverseFind('\x8c');
@@ -622,22 +622,22 @@ TEST(fxcrt, ByteStringReverseFind) {
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, ByteStringUpperLower) {
- CFX_ByteString fred("F-Re.42D");
+TEST(ByteString, UpperLower) {
+ ByteString fred("F-Re.42D");
fred.MakeLower();
EXPECT_EQ("f-re.42d", fred);
fred.MakeUpper();
EXPECT_EQ("F-RE.42D", fred);
- CFX_ByteString empty;
+ ByteString empty;
empty.MakeLower();
EXPECT_EQ("", empty);
empty.MakeUpper();
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringTrimRight) {
- CFX_ByteString fred(" FRED ");
+TEST(ByteString, TrimRight) {
+ ByteString fred(" FRED ");
fred.TrimRight();
EXPECT_EQ(" FRED", fred);
fred.TrimRight('E');
@@ -647,7 +647,7 @@ TEST(fxcrt, ByteStringTrimRight) {
fred.TrimRight("ERP");
EXPECT_EQ(" F", fred);
- CFX_ByteString blank(" ");
+ ByteString blank(" ");
blank.TrimRight("ERP");
EXPECT_EQ(" ", blank);
blank.TrimRight('E');
@@ -655,7 +655,7 @@ TEST(fxcrt, ByteStringTrimRight) {
blank.TrimRight();
EXPECT_EQ("", blank);
- CFX_ByteString empty;
+ ByteString empty;
empty.TrimRight("ERP");
EXPECT_EQ("", empty);
empty.TrimRight('E');
@@ -664,10 +664,10 @@ TEST(fxcrt, ByteStringTrimRight) {
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringTrimRightCopies) {
+TEST(ByteString, TrimRightCopies) {
{
// With a single reference, no copy takes place.
- CFX_ByteString fred(" FRED ");
+ ByteString fred(" FRED ");
const char* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(" FRED", fred);
@@ -675,8 +675,8 @@ TEST(fxcrt, ByteStringTrimRightCopies) {
}
{
// With multiple references, we must copy.
- CFX_ByteString fred(" FRED ");
- CFX_ByteString other_fred = fred;
+ ByteString fred(" FRED ");
+ ByteString other_fred = fred;
const char* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(" FRED", fred);
@@ -685,8 +685,8 @@ TEST(fxcrt, ByteStringTrimRightCopies) {
}
{
// With multiple references, but no modifications, no copy.
- CFX_ByteString fred("FRED");
- CFX_ByteString other_fred = fred;
+ ByteString fred("FRED");
+ ByteString other_fred = fred;
const char* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ("FRED", fred);
@@ -695,8 +695,8 @@ TEST(fxcrt, ByteStringTrimRightCopies) {
}
}
-TEST(fxcrt, ByteStringTrimLeft) {
- CFX_ByteString fred(" FRED ");
+TEST(ByteString, TrimLeft) {
+ ByteString fred(" FRED ");
fred.TrimLeft();
EXPECT_EQ("FRED ", fred);
fred.TrimLeft('E');
@@ -706,7 +706,7 @@ TEST(fxcrt, ByteStringTrimLeft) {
fred.TrimLeft("ERP");
EXPECT_EQ("D ", fred);
- CFX_ByteString blank(" ");
+ ByteString blank(" ");
blank.TrimLeft("ERP");
EXPECT_EQ(" ", blank);
blank.TrimLeft('E');
@@ -714,7 +714,7 @@ TEST(fxcrt, ByteStringTrimLeft) {
blank.TrimLeft();
EXPECT_EQ("", blank);
- CFX_ByteString empty;
+ ByteString empty;
empty.TrimLeft("ERP");
EXPECT_EQ("", empty);
empty.TrimLeft('E');
@@ -723,10 +723,10 @@ TEST(fxcrt, ByteStringTrimLeft) {
EXPECT_EQ("", empty);
}
-TEST(fxcrt, ByteStringTrimLeftCopies) {
+TEST(ByteString, TrimLeftCopies) {
{
// With a single reference, no copy takes place.
- CFX_ByteString fred(" FRED ");
+ ByteString fred(" FRED ");
const char* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ("FRED ", fred);
@@ -734,8 +734,8 @@ TEST(fxcrt, ByteStringTrimLeftCopies) {
}
{
// With multiple references, we must copy.
- CFX_ByteString fred(" FRED ");
- CFX_ByteString other_fred = fred;
+ ByteString fred(" FRED ");
+ ByteString other_fred = fred;
const char* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ("FRED ", fred);
@@ -744,8 +744,8 @@ TEST(fxcrt, ByteStringTrimLeftCopies) {
}
{
// With multiple references, but no modifications, no copy.
- CFX_ByteString fred("FRED");
- CFX_ByteString other_fred = fred;
+ ByteString fred("FRED");
+ ByteString other_fred = fred;
const char* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ("FRED", fred);
@@ -754,9 +754,9 @@ TEST(fxcrt, ByteStringTrimLeftCopies) {
}
}
-TEST(fxcrt, ByteStringReserve) {
+TEST(ByteString, Reserve) {
{
- CFX_ByteString str;
+ ByteString str;
str.Reserve(6);
const char* old_buffer = str.c_str();
str += "ABCDEF";
@@ -765,7 +765,7 @@ TEST(fxcrt, ByteStringReserve) {
EXPECT_NE(old_buffer, str.c_str());
}
{
- CFX_ByteString str("A");
+ ByteString str("A");
str.Reserve(6);
const char* old_buffer = str.c_str();
str += "BCDEF";
@@ -775,9 +775,9 @@ TEST(fxcrt, ByteStringReserve) {
}
}
-TEST(fxcrt, ByteStringGetBuffer) {
+TEST(ByteString, GetBuffer) {
{
- CFX_ByteString str;
+ ByteString str;
char* buffer = str.GetBuffer(12);
// NOLINTNEXTLINE(runtime/printf)
strcpy(buffer, "clams");
@@ -785,7 +785,7 @@ TEST(fxcrt, ByteStringGetBuffer) {
EXPECT_EQ("clams", str);
}
{
- CFX_ByteString str("cl");
+ ByteString str("cl");
char* buffer = str.GetBuffer(12);
// NOLINTNEXTLINE(runtime/printf)
strcpy(buffer + 2, "ams");
@@ -794,9 +794,9 @@ TEST(fxcrt, ByteStringGetBuffer) {
}
}
-TEST(fxcrt, ByteStringReleaseBuffer) {
+TEST(ByteString, ReleaseBuffer) {
{
- CFX_ByteString str;
+ ByteString str;
str.Reserve(12);
str += "clams";
const char* old_buffer = str.c_str();
@@ -805,7 +805,7 @@ TEST(fxcrt, ByteStringReleaseBuffer) {
EXPECT_EQ("clam", str);
}
{
- CFX_ByteString str("c");
+ ByteString str("c");
str.Reserve(12);
str += "lams";
const char* old_buffer = str.c_str();
@@ -814,7 +814,7 @@ TEST(fxcrt, ByteStringReleaseBuffer) {
EXPECT_EQ("clam", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Reserve(200);
str += "clams";
const char* old_buffer = str.c_str();
@@ -823,7 +823,7 @@ TEST(fxcrt, ByteStringReleaseBuffer) {
EXPECT_EQ("clam", str);
}
{
- CFX_ByteString str("c");
+ ByteString str("c");
str.Reserve(200);
str += "lams";
const char* old_buffer = str.c_str();
@@ -833,16 +833,16 @@ TEST(fxcrt, ByteStringReleaseBuffer) {
}
}
-TEST(fxcrt, ByteStringEmptyReverseIterator) {
- CFX_ByteString empty;
+TEST(ByteString, EmptyReverseIterator) {
+ ByteString empty;
auto iter = empty.rbegin();
EXPECT_TRUE(iter == empty.rend());
EXPECT_FALSE(iter != empty.rend());
EXPECT_FALSE(iter < empty.rend());
}
-TEST(fxcrt, ByteStringOneCharReverseIterator) {
- CFX_ByteString one_str("a");
+TEST(ByteString, OneCharReverseIterator) {
+ ByteString one_str("a");
auto iter = one_str.rbegin();
EXPECT_FALSE(iter == one_str.rend());
EXPECT_TRUE(iter != one_str.rend());
@@ -855,8 +855,8 @@ TEST(fxcrt, ByteStringOneCharReverseIterator) {
EXPECT_FALSE(iter < one_str.rend());
}
-TEST(fxcrt, ByteStringMultiCharReverseIterator) {
- CFX_ByteString multi_str("abcd");
+TEST(ByteString, MultiCharReverseIterator) {
+ ByteString multi_str("abcd");
auto iter = multi_str.rbegin();
EXPECT_FALSE(iter == multi_str.rend());
@@ -900,12 +900,12 @@ TEST(fxcrt, ByteStringMultiCharReverseIterator) {
EXPECT_TRUE(iter == multi_str.rbegin());
}
-TEST(fxcrt, ByteStringCNotNull) {
- CFX_ByteStringC string3("abc");
- CFX_ByteStringC string6("abcdef");
- CFX_ByteStringC alternate_string3("abcdef", 3);
- CFX_ByteStringC embedded_nul_string7("abc\0def", 7);
- CFX_ByteStringC illegal_string7("abcdef", 7);
+TEST(ByteStringView, NotNull) {
+ ByteStringView string3("abc");
+ ByteStringView string6("abcdef");
+ ByteStringView alternate_string3("abcdef", 3);
+ ByteStringView embedded_nul_string7("abc\0def", 7);
+ ByteStringView illegal_string7("abcdef", 7);
EXPECT_EQ(3u, string3.GetLength());
EXPECT_EQ(6u, string6.GetLength());
@@ -924,18 +924,18 @@ TEST(fxcrt, ByteStringCNotNull) {
EXPECT_NE(alternate_string3, illegal_string7);
EXPECT_NE(embedded_nul_string7, illegal_string7);
- CFX_ByteStringC copied_string3(string3);
- CFX_ByteStringC copied_alternate_string3(alternate_string3);
- CFX_ByteStringC copied_embedded_nul_string7(embedded_nul_string7);
+ ByteStringView copied_string3(string3);
+ ByteStringView copied_alternate_string3(alternate_string3);
+ ByteStringView copied_embedded_nul_string7(embedded_nul_string7);
EXPECT_EQ(string3, copied_string3);
EXPECT_EQ(alternate_string3, copied_alternate_string3);
EXPECT_EQ(embedded_nul_string7, copied_embedded_nul_string7);
- CFX_ByteStringC assigned_string3("intially something else");
- CFX_ByteStringC assigned_alternate_string3("initally something else");
- CFX_ByteStringC assigned_ptr_string3("initially something else");
- CFX_ByteStringC assigned_embedded_nul_string7("initially something else");
+ ByteStringView assigned_string3("intially something else");
+ ByteStringView assigned_alternate_string3("initally something else");
+ ByteStringView assigned_ptr_string3("initially something else");
+ ByteStringView assigned_embedded_nul_string7("initially something else");
assigned_string3 = string3;
assigned_alternate_string3 = alternate_string3;
@@ -947,15 +947,15 @@ TEST(fxcrt, ByteStringCNotNull) {
EXPECT_EQ(embedded_nul_string7, assigned_embedded_nul_string7);
}
-TEST(fxcrt, ByteStringCFromChar) {
- CFX_ByteStringC null_string;
- CFX_ByteStringC lower_a_string("a");
+TEST(ByteStringView, FromChar) {
+ ByteStringView null_string;
+ ByteStringView lower_a_string("a");
// Must have lvalues that outlive the corresponding ByteStringC.
char nul = '\0';
char lower_a = 'a';
- CFX_ByteStringC nul_string_from_char(nul);
- CFX_ByteStringC lower_a_string_from_char(lower_a);
+ ByteStringView nul_string_from_char(nul);
+ ByteStringView lower_a_string_from_char(lower_a);
// Pointer to nul, not nullptr ptr, hence length 1 ...
EXPECT_EQ(1u, nul_string_from_char.GetLength());
@@ -965,60 +965,60 @@ TEST(fxcrt, ByteStringCFromChar) {
EXPECT_EQ(lower_a_string, lower_a_string_from_char);
EXPECT_NE(nul_string_from_char, lower_a_string_from_char);
- CFX_ByteStringC longer_string("ab");
+ ByteStringView longer_string("ab");
EXPECT_NE(longer_string, lower_a_string_from_char);
}
-TEST(fxcrt, ByteStringCFromVector) {
+TEST(ByteStringView, FromVector) {
std::vector<uint8_t> null_vec;
- CFX_ByteStringC null_string(null_vec);
+ ByteStringView null_string(null_vec);
EXPECT_EQ(0u, null_string.GetLength());
std::vector<uint8_t> lower_a_vec(10, static_cast<uint8_t>('a'));
- CFX_ByteStringC lower_a_string(lower_a_vec);
+ ByteStringView lower_a_string(lower_a_vec);
EXPECT_EQ(static_cast<FX_STRSIZE>(10), lower_a_string.GetLength());
EXPECT_EQ("aaaaaaaaaa", lower_a_string);
std::vector<uint8_t> cleared_vec;
cleared_vec.push_back(42);
cleared_vec.pop_back();
- CFX_ByteStringC cleared_string(cleared_vec);
+ ByteStringView cleared_string(cleared_vec);
EXPECT_EQ(0u, cleared_string.GetLength());
EXPECT_EQ(nullptr, cleared_string.raw_str());
}
-TEST(fxcrt, ByteStringCGetID) {
- CFX_ByteStringC null_string;
+TEST(ByteStringView, GetID) {
+ ByteStringView null_string;
EXPECT_EQ(0u, null_string.GetID());
- CFX_ByteStringC empty_string("");
+ ByteStringView empty_string("");
EXPECT_EQ(0u, empty_string.GetID());
- CFX_ByteStringC short_string("ab");
+ ByteStringView short_string("ab");
EXPECT_EQ(FXBSTR_ID('a', 'b', 0, 0), short_string.GetID());
- CFX_ByteStringC longer_string("abcdef");
+ ByteStringView longer_string("abcdef");
EXPECT_EQ(FXBSTR_ID('a', 'b', 'c', 'd'), longer_string.GetID());
}
-TEST(fxcrt, ByteStringCFind) {
- CFX_ByteStringC null_string;
+TEST(ByteStringView, Find) {
+ ByteStringView null_string;
EXPECT_FALSE(null_string.Find('a').has_value());
EXPECT_FALSE(null_string.Find('\0').has_value());
- CFX_ByteStringC empty_string("");
+ ByteStringView empty_string("");
EXPECT_FALSE(empty_string.Find('a').has_value());
EXPECT_FALSE(empty_string.Find('\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_ByteStringC single_string("a");
+ ByteStringView single_string("a");
result = single_string.Find('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.Find('b').has_value());
EXPECT_FALSE(single_string.Find('\0').has_value());
- CFX_ByteStringC longer_string("abccc");
+ ByteStringView longer_string("abccc");
result = longer_string.Find('a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -1028,7 +1028,7 @@ TEST(fxcrt, ByteStringCFind) {
EXPECT_FALSE(longer_string.Find('d').has_value());
EXPECT_FALSE(longer_string.Find('\0').has_value());
- CFX_ByteStringC hibyte_string(
+ ByteStringView hibyte_string(
"ab\x8c"
"def");
result = hibyte_string.Find('\x8c');
@@ -1036,47 +1036,47 @@ TEST(fxcrt, ByteStringCFind) {
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, ByteStringCMid) {
- CFX_ByteStringC null_string;
+TEST(ByteStringView, Mid) {
+ ByteStringView null_string;
EXPECT_EQ(null_string, null_string.Mid(0, 1));
EXPECT_EQ(null_string, null_string.Mid(1, 1));
- CFX_ByteStringC empty_string("");
+ ByteStringView empty_string("");
EXPECT_EQ("", empty_string.Mid(0, 1));
EXPECT_EQ("", empty_string.Mid(1, 1));
- CFX_ByteStringC single_character("a");
+ ByteStringView single_character("a");
EXPECT_EQ("", single_character.Mid(0, 0));
EXPECT_EQ(single_character, single_character.Mid(0, 1));
EXPECT_EQ("", single_character.Mid(1, 0));
EXPECT_EQ("", single_character.Mid(1, 1));
- CFX_ByteStringC longer_string("abcdef");
+ ByteStringView longer_string("abcdef");
EXPECT_EQ(longer_string, longer_string.Mid(0, 6));
EXPECT_EQ("", longer_string.Mid(0, 187));
- CFX_ByteStringC leading_substring("ab");
+ ByteStringView leading_substring("ab");
EXPECT_EQ(leading_substring, longer_string.Mid(0, 2));
- CFX_ByteStringC middle_substring("bcde");
+ ByteStringView middle_substring("bcde");
EXPECT_EQ(middle_substring, longer_string.Mid(1, 4));
- CFX_ByteStringC trailing_substring("ef");
+ ByteStringView trailing_substring("ef");
EXPECT_EQ(trailing_substring, longer_string.Mid(4, 2));
EXPECT_EQ("", longer_string.Mid(4, 3));
}
-TEST(fxcrt, ByteStringCTrimmedRight) {
- CFX_ByteStringC fred("FRED");
+TEST(ByteStringView, TrimmedRight) {
+ ByteStringView fred("FRED");
EXPECT_EQ("FRED", fred.TrimmedRight('E'));
EXPECT_EQ("FRE", fred.TrimmedRight('D'));
- CFX_ByteStringC fredd("FREDD");
+ ByteStringView fredd("FREDD");
EXPECT_EQ("FRE", fred.TrimmedRight('D'));
}
-TEST(fxcrt, ByteStringCElementAccess) {
- // CFX_ByteStringC includes the NUL terminator for non-empty strings.
- CFX_ByteStringC abc("abc");
+TEST(ByteStringView, ElementAccess) {
+ // ByteStringView includes the NUL terminator for non-empty strings.
+ ByteStringView abc("abc");
EXPECT_EQ('a', static_cast<char>(abc[0]));
EXPECT_EQ('b', static_cast<char>(abc[1]));
EXPECT_EQ('c', static_cast<char>(abc[2]));
@@ -1085,11 +1085,11 @@ TEST(fxcrt, ByteStringCElementAccess) {
#endif
}
-TEST(fxcrt, ByteStringCOperatorLT) {
- CFX_ByteStringC empty;
- CFX_ByteStringC a("a");
- CFX_ByteStringC abc("abc");
- CFX_ByteStringC def("def");
+TEST(ByteStringView, OperatorLT) {
+ ByteStringView empty;
+ ByteStringView a("a");
+ ByteStringView abc("abc");
+ ByteStringView def("def");
EXPECT_FALSE(empty < empty);
EXPECT_FALSE(a < a);
@@ -1115,21 +1115,21 @@ TEST(fxcrt, ByteStringCOperatorLT) {
EXPECT_FALSE(def < abc);
}
-TEST(fxcrt, ByteStringCOperatorEQ) {
- CFX_ByteStringC byte_string_c("hello");
+TEST(ByteStringView, OperatorEQ) {
+ ByteStringView byte_string_c("hello");
EXPECT_TRUE(byte_string_c == byte_string_c);
- CFX_ByteStringC byte_string_c_same1("hello");
+ ByteStringView byte_string_c_same1("hello");
EXPECT_TRUE(byte_string_c == byte_string_c_same1);
EXPECT_TRUE(byte_string_c_same1 == byte_string_c);
- CFX_ByteStringC byte_string_c_same2(byte_string_c);
+ ByteStringView byte_string_c_same2(byte_string_c);
EXPECT_TRUE(byte_string_c == byte_string_c_same2);
EXPECT_TRUE(byte_string_c_same2 == byte_string_c);
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
+ ByteStringView byte_string_c1("he");
+ ByteStringView byte_string_c2("hellp");
+ ByteStringView byte_string_c3("hellod");
EXPECT_FALSE(byte_string_c == byte_string_c1);
EXPECT_FALSE(byte_string_c == byte_string_c2);
EXPECT_FALSE(byte_string_c == byte_string_c3);
@@ -1137,13 +1137,13 @@ TEST(fxcrt, ByteStringCOperatorEQ) {
EXPECT_FALSE(byte_string_c2 == byte_string_c);
EXPECT_FALSE(byte_string_c3 == byte_string_c);
- CFX_ByteString byte_string_same1("hello");
+ ByteString byte_string_same1("hello");
EXPECT_TRUE(byte_string_c == byte_string_same1);
EXPECT_TRUE(byte_string_same1 == byte_string_c);
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
+ ByteString byte_string1("he");
+ ByteString byte_string2("hellp");
+ ByteString byte_string3("hellod");
EXPECT_FALSE(byte_string_c == byte_string1);
EXPECT_FALSE(byte_string_c == byte_string2);
EXPECT_FALSE(byte_string_c == byte_string3);
@@ -1167,21 +1167,21 @@ TEST(fxcrt, ByteStringCOperatorEQ) {
EXPECT_FALSE(c_string3 == byte_string_c);
}
-TEST(fxcrt, ByteStringCOperatorNE) {
- CFX_ByteStringC byte_string_c("hello");
+TEST(ByteStringView, OperatorNE) {
+ ByteStringView byte_string_c("hello");
EXPECT_FALSE(byte_string_c != byte_string_c);
- CFX_ByteStringC byte_string_c_same1("hello");
+ ByteStringView byte_string_c_same1("hello");
EXPECT_FALSE(byte_string_c != byte_string_c_same1);
EXPECT_FALSE(byte_string_c_same1 != byte_string_c);
- CFX_ByteStringC byte_string_c_same2(byte_string_c);
+ ByteStringView byte_string_c_same2(byte_string_c);
EXPECT_FALSE(byte_string_c != byte_string_c_same2);
EXPECT_FALSE(byte_string_c_same2 != byte_string_c);
- CFX_ByteStringC byte_string_c1("he");
- CFX_ByteStringC byte_string_c2("hellp");
- CFX_ByteStringC byte_string_c3("hellod");
+ ByteStringView byte_string_c1("he");
+ ByteStringView byte_string_c2("hellp");
+ ByteStringView byte_string_c3("hellod");
EXPECT_TRUE(byte_string_c != byte_string_c1);
EXPECT_TRUE(byte_string_c != byte_string_c2);
EXPECT_TRUE(byte_string_c != byte_string_c3);
@@ -1189,13 +1189,13 @@ TEST(fxcrt, ByteStringCOperatorNE) {
EXPECT_TRUE(byte_string_c2 != byte_string_c);
EXPECT_TRUE(byte_string_c3 != byte_string_c);
- CFX_ByteString byte_string_same1("hello");
+ ByteString byte_string_same1("hello");
EXPECT_FALSE(byte_string_c != byte_string_same1);
EXPECT_FALSE(byte_string_same1 != byte_string_c);
- CFX_ByteString byte_string1("he");
- CFX_ByteString byte_string2("hellp");
- CFX_ByteString byte_string3("hellod");
+ ByteString byte_string1("he");
+ ByteString byte_string2("hellp");
+ ByteString byte_string3("hellod");
EXPECT_TRUE(byte_string_c != byte_string1);
EXPECT_TRUE(byte_string_c != byte_string2);
EXPECT_TRUE(byte_string_c != byte_string3);
@@ -1219,8 +1219,8 @@ TEST(fxcrt, ByteStringCOperatorNE) {
EXPECT_TRUE(c_string3 != byte_string_c);
}
-TEST(fxcrt, ByteStringCNullIterator) {
- CFX_ByteStringC null_str;
+TEST(ByteStringView, NullIterator) {
+ ByteStringView null_str;
int32_t sum = 0;
bool any_present = false;
for (const auto& c : null_str) {
@@ -1231,8 +1231,8 @@ TEST(fxcrt, ByteStringCNullIterator) {
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, ByteStringCEmptyIterator) {
- CFX_ByteStringC empty_str("");
+TEST(ByteStringView, EmptyIterator) {
+ ByteStringView empty_str("");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : empty_str) {
@@ -1243,8 +1243,8 @@ TEST(fxcrt, ByteStringCEmptyIterator) {
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, ByteStringCOneCharIterator) {
- CFX_ByteStringC one_str("a");
+TEST(ByteStringView, OneCharIterator) {
+ ByteStringView one_str("a");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1255,8 +1255,8 @@ TEST(fxcrt, ByteStringCOneCharIterator) {
EXPECT_EQ('a', sum);
}
-TEST(fxcrt, ByteStringCMultiCharIterator) {
- CFX_ByteStringC one_str("abc");
+TEST(ByteStringView, MultiCharIterator) {
+ ByteStringView one_str("abc");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1267,16 +1267,16 @@ TEST(fxcrt, ByteStringCMultiCharIterator) {
EXPECT_EQ('a' + 'b' + 'c', sum);
}
-TEST(fxcrt, ByteStringCEmptyReverseIterator) {
- CFX_ByteStringC empty;
+TEST(ByteStringView, EmptyReverseIterator) {
+ ByteStringView empty;
auto iter = empty.rbegin();
EXPECT_TRUE(iter == empty.rend());
EXPECT_FALSE(iter != empty.rend());
EXPECT_FALSE(iter < empty.rend());
}
-TEST(fxcrt, ByteStringCOneCharReverseIterator) {
- CFX_ByteStringC one_str("a");
+TEST(ByteStringView, OneCharReverseIterator) {
+ ByteStringView one_str("a");
auto iter = one_str.rbegin();
EXPECT_FALSE(iter == one_str.rend());
EXPECT_TRUE(iter != one_str.rend());
@@ -1289,8 +1289,8 @@ TEST(fxcrt, ByteStringCOneCharReverseIterator) {
EXPECT_FALSE(iter < one_str.rend());
}
-TEST(fxcrt, ByteStringCMultiCharReverseIterator) {
- CFX_ByteStringC multi_str("abcd");
+TEST(ByteStringView, MultiCharReverseIterator) {
+ ByteStringView multi_str("abcd");
auto iter = multi_str.rbegin();
EXPECT_FALSE(iter == multi_str.rend());
@@ -1334,8 +1334,8 @@ TEST(fxcrt, ByteStringCMultiCharReverseIterator) {
EXPECT_TRUE(iter == multi_str.rbegin());
}
-TEST(fxcrt, ByteStringCAnyAllNoneOf) {
- CFX_ByteStringC str("aaaaaaaaaaaaaaaaab");
+TEST(ByteStringView, AnyAllNoneOf) {
+ ByteStringView str("aaaaaaaaaaaaaaaaab");
EXPECT_FALSE(std::all_of(str.begin(), str.end(),
[](const char& c) { return c == 'a'; }));
@@ -1350,87 +1350,87 @@ TEST(fxcrt, ByteStringCAnyAllNoneOf) {
EXPECT_FALSE(pdfium::ContainsValue(str, 'z'));
}
-TEST(fxcrt, ByteStringFormatWidth) {
+TEST(ByteString, FormatWidth) {
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%5d", 1);
EXPECT_EQ(" 1", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%d", 1);
EXPECT_EQ("1", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%*d", 5, 1);
EXPECT_EQ(" 1", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%-1d", 1);
EXPECT_EQ("1", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%0d", 1);
EXPECT_EQ("1", str);
}
}
-TEST(fxcrt, ByteStringFormatPrecision) {
+TEST(ByteString, FormatPrecision) {
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%.2f", 1.12345);
EXPECT_EQ("1.12", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%.*f", 3, 1.12345);
EXPECT_EQ("1.123", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%f", 1.12345);
EXPECT_EQ("1.123450", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%-1f", 1.12345);
EXPECT_EQ("1.123450", str);
}
{
- CFX_ByteString str;
+ ByteString str;
str.Format("%0f", 1.12345);
EXPECT_EQ("1.123450", str);
}
}
-TEST(fxcrt, EmptyByteString) {
- CFX_ByteString empty_str;
+TEST(ByteString, Empty) {
+ ByteString empty_str;
EXPECT_TRUE(empty_str.IsEmpty());
EXPECT_EQ(0u, empty_str.GetLength());
const char* cstr = empty_str.c_str();
EXPECT_EQ(0u, FXSYS_strlen(cstr));
}
-TEST(fxcrt, ByteStringInitializerList) {
- CFX_ByteString many_str({"clams", " and ", "oysters"});
+TEST(ByteString, InitializerList) {
+ ByteString many_str({"clams", " and ", "oysters"});
EXPECT_EQ("clams and oysters", many_str);
many_str = {"fish", " and ", "chips", " and ", "soda"};
EXPECT_EQ("fish and chips and soda", many_str);
}
-TEST(fxcrt, ByteStringNullIterator) {
- CFX_ByteString null_str;
+TEST(ByteString, NullIterator) {
+ ByteString null_str;
int32_t sum = 0;
bool any_present = false;
for (const auto& c : null_str) {
@@ -1441,8 +1441,8 @@ TEST(fxcrt, ByteStringNullIterator) {
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, ByteStringEmptyIterator) {
- CFX_ByteString empty_str("");
+TEST(ByteString, EmptyIterator) {
+ ByteString empty_str("");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : empty_str) {
@@ -1453,8 +1453,8 @@ TEST(fxcrt, ByteStringEmptyIterator) {
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, ByteStringOneCharIterator) {
- CFX_ByteString one_str("a");
+TEST(ByteString, OneCharIterator) {
+ ByteString one_str("a");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1465,8 +1465,8 @@ TEST(fxcrt, ByteStringOneCharIterator) {
EXPECT_EQ('a', sum);
}
-TEST(fxcrt, ByteStringMultiCharIterator) {
- CFX_ByteString one_str("abc");
+TEST(ByteString, MultiCharIterator) {
+ ByteString one_str("abc");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1477,8 +1477,8 @@ TEST(fxcrt, ByteStringMultiCharIterator) {
EXPECT_EQ('a' + 'b' + 'c', sum);
}
-TEST(fxcrt, ByteStringAnyAllNoneOf) {
- CFX_ByteString str("aaaaaaaaaaaaaaaaab");
+TEST(ByteString, AnyAllNoneOf) {
+ ByteString str("aaaaaaaaaaaaaaaaab");
EXPECT_FALSE(std::all_of(str.begin(), str.end(),
[](const char& c) { return c == 'a'; }));
@@ -1493,8 +1493,8 @@ TEST(fxcrt, ByteStringAnyAllNoneOf) {
EXPECT_FALSE(pdfium::ContainsValue(str, 'z'));
}
-TEST(fxcrt, EqualNoCase) {
- CFX_ByteString str("aaa");
+TEST(CFX_BytrString, EqualNoCase) {
+ ByteString str("aaa");
EXPECT_TRUE(str.EqualNoCase("aaa"));
EXPECT_TRUE(str.EqualNoCase("AAA"));
EXPECT_TRUE(str.EqualNoCase("aaA"));
@@ -1506,11 +1506,11 @@ TEST(fxcrt, EqualNoCase) {
EXPECT_FALSE(str.EqualNoCase(""));
}
-TEST(fxcrt, OStreamByteStringOverload) {
+TEST(ByteString, OStreamOverload) {
std::ostringstream stream;
// Basic case, empty string
- CFX_ByteString str;
+ ByteString str;
stream << str;
EXPECT_EQ("", stream.str());
@@ -1520,7 +1520,7 @@ TEST(fxcrt, OStreamByteStringOverload) {
stream << "abc" << str << "ghi";
EXPECT_EQ("abcdefghi", stream.str());
- // Changing the CFX_ByteString does not change the stream it was written to.
+ // Changing the ByteString does not change the stream it was written to.
str = "123";
EXPECT_EQ("abcdefghi", stream.str());
@@ -1531,35 +1531,35 @@ TEST(fxcrt, OStreamByteStringOverload) {
char stringWithNulls[]{'x', 'y', '\0', 'z'};
- // Writing a CFX_ByteString with nulls and no specified length treats it as
+ // Writing a ByteString with nulls and no specified length treats it as
// a C-style null-terminated string.
- str = CFX_ByteString(stringWithNulls);
+ str = ByteString(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream.str("");
stream << str;
EXPECT_EQ(2u, stream.tellp());
- // Writing a CFX_ByteString with nulls but specifying its length treats it as
+ // Writing a ByteString with nulls but specifying its length treats it as
// a C++-style string.
- str = CFX_ByteString(stringWithNulls, 4);
+ str = ByteString(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream.str("");
stream << str;
EXPECT_EQ(4u, stream.tellp());
// << operators can be chained.
- CFX_ByteString str1("abc");
- CFX_ByteString str2("def");
+ ByteString str1("abc");
+ ByteString str2("def");
stream.str("");
stream << str1 << str2;
EXPECT_EQ("abcdef", stream.str());
}
-TEST(fxcrt, OStreamByteStringCOverload) {
+TEST(ByteStringView, OStreamOverload) {
// Basic case, empty string
{
std::ostringstream stream;
- CFX_ByteStringC str;
+ ByteStringView str;
stream << str;
EXPECT_EQ("", stream.str());
}
@@ -1567,15 +1567,15 @@ TEST(fxcrt, OStreamByteStringCOverload) {
// Basic case, non-empty string
{
std::ostringstream stream;
- CFX_ByteStringC str("def");
+ ByteStringView str("def");
stream << "abc" << str << "ghi";
EXPECT_EQ("abcdefghi", stream.str());
}
- // Changing the CFX_ByteStringC does not change the stream it was written to.
+ // Changing the ByteStringView does not change the stream it was written to.
{
std::ostringstream stream;
- CFX_ByteStringC str("abc");
+ ByteStringView str("abc");
stream << str;
str = "123";
EXPECT_EQ("abc", stream.str());
@@ -1584,7 +1584,7 @@ TEST(fxcrt, OStreamByteStringCOverload) {
// Writing it again to the stream will use the latest value.
{
std::ostringstream stream;
- CFX_ByteStringC str("abc");
+ ByteStringView str("abc");
stream << str;
stream.str("");
str = "123";
@@ -1592,24 +1592,24 @@ TEST(fxcrt, OStreamByteStringCOverload) {
EXPECT_EQ("123", stream.str());
}
- // Writing a CFX_ByteStringC with nulls and no specified length treats it as
+ // Writing a ByteStringView with nulls and no specified length treats it as
// a C-style null-terminated string.
{
std::ostringstream stream;
char stringWithNulls[]{'x', 'y', '\0', 'z'};
- CFX_ByteStringC str(stringWithNulls);
+ ByteStringView str(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream << str;
EXPECT_EQ(2u, stream.tellp());
str = "";
}
- // Writing a CFX_ByteStringC with nulls but specifying its length treats it as
+ // Writing a ByteStringView with nulls but specifying its length treats it as
// a C++-style string.
{
std::ostringstream stream;
char stringWithNulls[]{'x', 'y', '\0', 'z'};
- CFX_ByteStringC str(stringWithNulls, 4);
+ ByteStringView str(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream << str;
EXPECT_EQ(4u, stream.tellp());
@@ -1619,24 +1619,24 @@ TEST(fxcrt, OStreamByteStringCOverload) {
// << operators can be chained.
{
std::ostringstream stream;
- CFX_ByteStringC str1("abc");
- CFX_ByteStringC str2("def");
+ ByteStringView str1("abc");
+ ByteStringView str2("def");
stream << str1 << str2;
EXPECT_EQ("abcdef", stream.str());
}
}
-TEST(fxcrt, ByteStringFormatInteger) {
+TEST(ByteString, FormatInteger) {
// Base case of 0.
- EXPECT_EQ("0", CFX_ByteString::FormatInteger(0));
+ EXPECT_EQ("0", ByteString::FormatInteger(0));
// Positive ordinary number.
- EXPECT_EQ("123456", CFX_ByteString::FormatInteger(123456));
+ EXPECT_EQ("123456", ByteString::FormatInteger(123456));
// Negative ordinary number.
- EXPECT_EQ("-123456", CFX_ByteString::FormatInteger(-123456));
+ EXPECT_EQ("-123456", ByteString::FormatInteger(-123456));
// int limits.
- EXPECT_EQ("2147483647", CFX_ByteString::FormatInteger(INT_MAX));
- EXPECT_EQ("-2147483648", CFX_ByteString::FormatInteger(INT_MIN));
+ EXPECT_EQ("2147483647", ByteString::FormatInteger(INT_MAX));
+ EXPECT_EQ("-2147483648", ByteString::FormatInteger(INT_MIN));
}
diff --git a/core/fxcrt/cfx_binarybuf.h b/core/fxcrt/cfx_binarybuf.h
index 4c795eda0b..186d8d1b88 100644
--- a/core/fxcrt/cfx_binarybuf.h
+++ b/core/fxcrt/cfx_binarybuf.h
@@ -27,7 +27,7 @@ class CFX_BinaryBuf {
void Clear();
void EstimateSize(FX_STRSIZE size, FX_STRSIZE alloc_step = 0);
void AppendBlock(const void* pBuf, FX_STRSIZE size);
- void AppendString(const CFX_ByteString& str) {
+ void AppendString(const ByteString& str) {
AppendBlock(str.c_str(), str.GetLength());
}
diff --git a/core/fxcrt/cfx_blockbuffer.cpp b/core/fxcrt/cfx_blockbuffer.cpp
index aeef5653e8..13134f0e7b 100644
--- a/core/fxcrt/cfx_blockbuffer.cpp
+++ b/core/fxcrt/cfx_blockbuffer.cpp
@@ -70,19 +70,19 @@ void CFX_BlockBuffer::DeleteTextChars(size_t count) {
m_DataLength -= count;
}
-CFX_WideString CFX_BlockBuffer::GetTextData(size_t start, size_t length) const {
+WideString CFX_BlockBuffer::GetTextData(size_t start, size_t length) const {
if (m_BufferSize <= m_StartPosition + 1 || length == 0)
- return CFX_WideString();
+ return WideString();
size_t maybeDataLength = m_BufferSize - 1 - m_StartPosition;
if (start > maybeDataLength)
- return CFX_WideString();
+ return WideString();
length = std::min(length, maybeDataLength);
- CFX_WideString wsTextData;
+ WideString wsTextData;
wchar_t* pBuf = wsTextData.GetBuffer(length);
if (!pBuf)
- return CFX_WideString();
+ return WideString();
size_t startBlock = 0;
size_t startInner = 0;
diff --git a/core/fxcrt/cfx_blockbuffer.h b/core/fxcrt/cfx_blockbuffer.h
index 867449074d..423aa6820b 100644
--- a/core/fxcrt/cfx_blockbuffer.h
+++ b/core/fxcrt/cfx_blockbuffer.h
@@ -37,7 +37,7 @@ class CFX_BlockBuffer {
void SetTextChar(size_t iIndex, wchar_t ch);
void DeleteTextChars(size_t iCount);
- CFX_WideString GetTextData(size_t iStart, size_t iLength) const;
+ WideString GetTextData(size_t iStart, size_t iLength) const;
private:
std::pair<size_t, size_t> TextDataIndex2BufIndex(const size_t iIndex) const;
diff --git a/core/fxcrt/cfx_bytestring.h b/core/fxcrt/cfx_bytestring.h
deleted file mode 100644
index b976287617..0000000000
--- a/core/fxcrt/cfx_bytestring.h
+++ /dev/null
@@ -1,273 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FXCRT_CFX_BYTESTRING_H_
-#define CORE_FXCRT_CFX_BYTESTRING_H_
-
-#include <functional>
-#include <iterator>
-#include <sstream>
-#include <utility>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/cfx_string_c_template.h"
-#include "core/fxcrt/cfx_string_data_template.h"
-#include "core/fxcrt/fx_system.h"
-#include "third_party/base/optional.h"
-
-class CFX_WideString;
-
-// A mutable string with shared buffers using copy-on-write semantics that
-// avoids the cost of std::string's iterator stability guarantees.
-class CFX_ByteString {
- public:
- using CharType = char;
- using const_iterator = const CharType*;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
- CFX_ByteString();
- CFX_ByteString(const CFX_ByteString& other);
- CFX_ByteString(CFX_ByteString&& other) noexcept;
-
- // Deliberately implicit to avoid calling on every string literal.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_ByteString(char ch);
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_ByteString(const char* ptr);
-
- // No implicit conversions from wide strings.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_ByteString(wchar_t) = delete;
-
- CFX_ByteString(const char* ptr, FX_STRSIZE len);
- CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len);
-
- explicit CFX_ByteString(const CFX_ByteStringC& bstrc);
- CFX_ByteString(const CFX_ByteStringC& bstrc1, const CFX_ByteStringC& bstrc2);
- CFX_ByteString(const std::initializer_list<CFX_ByteStringC>& list);
- explicit CFX_ByteString(const std::ostringstream& outStream);
-
- ~CFX_ByteString();
-
- void clear() { m_pData.Reset(); }
-
- static CFX_ByteString FromUnicode(const CFX_WideString& str);
-
- // Explicit conversion to C-style string.
- // Note: Any subsequent modification of |this| will invalidate the result.
- const char* c_str() const { return m_pData ? m_pData->m_String : ""; }
-
- // Explicit conversion to uint8_t*.
- // Note: Any subsequent modification of |this| will invalidate the result.
- const uint8_t* raw_str() const {
- return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
- : nullptr;
- }
-
- // Explicit conversion to CFX_ByteStringC.
- // Note: Any subsequent modification of |this| will invalidate the result.
- CFX_ByteStringC AsStringC() const {
- return CFX_ByteStringC(raw_str(), GetLength());
- }
-
- // Note: Any subsequent modification of |this| will invalidate iterators.
- const_iterator begin() const { return m_pData ? m_pData->m_String : nullptr; }
- const_iterator end() const {
- return m_pData ? m_pData->m_String + m_pData->m_nDataLength : nullptr;
- }
-
- // Note: Any subsequent modification of |this| will invalidate iterators.
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
-
- FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
- FX_STRSIZE GetStringLength() const {
- return m_pData ? FXSYS_strlen(m_pData->m_String) : 0;
- }
- bool IsEmpty() const { return !GetLength(); }
- bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
- bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
-
- int Compare(const CFX_ByteStringC& str) const;
- bool EqualNoCase(const CFX_ByteStringC& str) const;
-
- bool operator==(const char* ptr) const;
- bool operator==(const CFX_ByteStringC& str) const;
- bool operator==(const CFX_ByteString& other) const;
-
- bool operator!=(const char* ptr) const { return !(*this == ptr); }
- bool operator!=(const CFX_ByteStringC& str) const { return !(*this == str); }
- bool operator!=(const CFX_ByteString& other) const {
- return !(*this == other);
- }
-
- bool operator<(const CFX_ByteString& str) const;
-
- const CFX_ByteString& operator=(const char* str);
- const CFX_ByteString& operator=(const CFX_ByteStringC& bstrc);
- const CFX_ByteString& operator=(const CFX_ByteString& stringSrc);
-
- const CFX_ByteString& operator+=(char ch);
- const CFX_ByteString& operator+=(const char* str);
- const CFX_ByteString& operator+=(const CFX_ByteString& str);
- const CFX_ByteString& operator+=(const CFX_ByteStringC& bstrc);
-
- CharType operator[](const FX_STRSIZE index) const {
- ASSERT(IsValidIndex(index));
- return m_pData ? m_pData->m_String[index] : 0;
- }
-
- CharType First() const { return GetLength() ? (*this)[0] : 0; }
- CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
-
- void SetAt(FX_STRSIZE index, char c);
-
- FX_STRSIZE Insert(FX_STRSIZE index, char ch);
- FX_STRSIZE InsertAtFront(char ch) { return Insert(0, ch); }
- FX_STRSIZE InsertAtBack(char ch) { return Insert(GetLength(), ch); }
- FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
-
- void Format(const char* lpszFormat, ...);
- void FormatV(const char* lpszFormat, va_list argList);
-
- void Reserve(FX_STRSIZE len);
- char* GetBuffer(FX_STRSIZE len);
- void ReleaseBuffer(FX_STRSIZE len);
-
- CFX_ByteString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
- CFX_ByteString Left(FX_STRSIZE count) const;
- CFX_ByteString Right(FX_STRSIZE count) const;
-
- pdfium::Optional<FX_STRSIZE> Find(const CFX_ByteStringC& lpszSub,
- FX_STRSIZE start = 0) const;
- pdfium::Optional<FX_STRSIZE> Find(char ch, FX_STRSIZE start = 0) const;
- pdfium::Optional<FX_STRSIZE> ReverseFind(char ch) const;
-
- bool Contains(const CFX_ByteStringC& lpszSub, FX_STRSIZE start = 0) const {
- return Find(lpszSub, start).has_value();
- }
-
- bool Contains(char ch, FX_STRSIZE start = 0) const {
- return Find(ch, start).has_value();
- }
-
- void MakeLower();
- void MakeUpper();
-
- void TrimRight();
- void TrimRight(char chTarget);
- void TrimRight(const CFX_ByteStringC& lpszTargets);
-
- void TrimLeft();
- void TrimLeft(char chTarget);
- void TrimLeft(const CFX_ByteStringC& lpszTargets);
-
- FX_STRSIZE Replace(const CFX_ByteStringC& lpszOld,
- const CFX_ByteStringC& lpszNew);
-
- FX_STRSIZE Remove(char ch);
-
- CFX_WideString UTF8Decode() const;
-
- uint32_t GetID() const { return AsStringC().GetID(); }
-
- static CFX_ByteString FormatInteger(int i);
- static CFX_ByteString FormatFloat(float f, int precision = 0);
-
- protected:
- using StringData = CFX_StringDataTemplate<char>;
-
- void ReallocBeforeWrite(FX_STRSIZE nNewLen);
- void AllocBeforeWrite(FX_STRSIZE nNewLen);
- void AllocCopy(CFX_ByteString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const;
- void AssignCopy(const char* pSrcData, FX_STRSIZE nSrcLen);
- void Concat(const char* lpszSrcData, FX_STRSIZE nSrcLen);
-
- CFX_RetainPtr<StringData> m_pData;
-
- friend class fxcrt_ByteStringConcat_Test;
- friend class fxcrt_ByteStringPool_Test;
-};
-
-inline bool operator==(const char* lhs, const CFX_ByteString& rhs) {
- return rhs == lhs;
-}
-inline bool operator==(const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
- return rhs == lhs;
-}
-inline bool operator!=(const char* lhs, const CFX_ByteString& rhs) {
- return rhs != lhs;
-}
-inline bool operator!=(const CFX_ByteStringC& lhs, const CFX_ByteString& rhs) {
- return rhs != lhs;
-}
-
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
- const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1, str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1, const char* str2) {
- return CFX_ByteString(str1, str2);
-}
-inline CFX_ByteString operator+(const char* str1, const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1, str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1, char ch) {
- return CFX_ByteString(str1, CFX_ByteStringC(ch));
-}
-inline CFX_ByteString operator+(char ch, const CFX_ByteStringC& str2) {
- return CFX_ByteString(ch, str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1,
- const CFX_ByteString& str2) {
- return CFX_ByteString(str1.AsStringC(), str2.AsStringC());
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1, char ch) {
- return CFX_ByteString(str1.AsStringC(), CFX_ByteStringC(ch));
-}
-inline CFX_ByteString operator+(char ch, const CFX_ByteString& str2) {
- return CFX_ByteString(ch, str2.AsStringC());
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1, const char* str2) {
- return CFX_ByteString(str1.AsStringC(), str2);
-}
-inline CFX_ByteString operator+(const char* str1, const CFX_ByteString& str2) {
- return CFX_ByteString(str1, str2.AsStringC());
-}
-inline CFX_ByteString operator+(const CFX_ByteString& str1,
- const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1.AsStringC(), str2);
-}
-inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
- const CFX_ByteString& str2) {
- return CFX_ByteString(str1, str2.AsStringC());
-}
-
-uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase);
-
-std::ostream& operator<<(std::ostream& os, const CFX_ByteString& str);
-std::ostream& operator<<(std::ostream& os, const CFX_ByteStringC& str);
-
-namespace std {
-
-template <>
-struct hash<CFX_ByteString> {
- std::size_t operator()(const CFX_ByteString& str) const {
- return FX_HashCode_GetA(str.AsStringC(), false);
- }
-};
-
-} // namespace std
-
-extern template struct std::hash<CFX_ByteString>;
-
-#endif // CORE_FXCRT_CFX_BYTESTRING_H_
diff --git a/core/fxcrt/cfx_checksumcontext.cpp b/core/fxcrt/cfx_checksumcontext.cpp
index 31140169b4..c75e440231 100644
--- a/core/fxcrt/cfx_checksumcontext.cpp
+++ b/core/fxcrt/cfx_checksumcontext.cpp
@@ -140,11 +140,11 @@ void CFX_ChecksumContext::FinishChecksum() {
}
}
-CFX_ByteString CFX_ChecksumContext::GetChecksum() const {
+ByteString CFX_ChecksumContext::GetChecksum() const {
return m_bsChecksum;
}
-void CFX_ChecksumContext::Update(const CFX_ByteStringC& bsText) {
+void CFX_ChecksumContext::Update(const ByteStringView& bsText) {
if (!m_pByteContext)
return;
diff --git a/core/fxcrt/cfx_checksumcontext.h b/core/fxcrt/cfx_checksumcontext.h
index 8869c540fb..4231e09a83 100644
--- a/core/fxcrt/cfx_checksumcontext.h
+++ b/core/fxcrt/cfx_checksumcontext.h
@@ -18,17 +18,17 @@ class CFX_ChecksumContext {
~CFX_ChecksumContext();
void StartChecksum();
- void Update(const CFX_ByteStringC& bsText);
+ void Update(const ByteStringView& bsText);
bool UpdateChecksum(const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
FX_FILESIZE offset = 0,
size_t size = 0);
void FinishChecksum();
- CFX_ByteString GetChecksum() const;
+ ByteString GetChecksum() const;
private:
std::unique_ptr<CFX_SAXReader> m_pSAXReader;
std::unique_ptr<CRYPT_sha1_context> m_pByteContext;
- CFX_ByteString m_bsChecksum;
+ ByteString m_bsChecksum;
};
#endif // CORE_FXCRT_CFX_CHECKSUMCONTEXT_H_
diff --git a/core/fxcrt/cfx_crtfileaccess.cpp b/core/fxcrt/cfx_crtfileaccess.cpp
index ddca68e144..2479c95654 100644
--- a/core/fxcrt/cfx_crtfileaccess.cpp
+++ b/core/fxcrt/cfx_crtfileaccess.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/cfx_crtfileaccess.h"
-CFX_CRTFileAccess::CFX_CRTFileAccess(const CFX_WideStringC& wsPath)
+CFX_CRTFileAccess::CFX_CRTFileAccess(const WideStringView& wsPath)
: m_path(wsPath) {}
CFX_CRTFileAccess::~CFX_CRTFileAccess() {}
diff --git a/core/fxcrt/cfx_crtfileaccess.h b/core/fxcrt/cfx_crtfileaccess.h
index cb2a034f20..3c63aa30c3 100644
--- a/core/fxcrt/cfx_crtfileaccess.h
+++ b/core/fxcrt/cfx_crtfileaccess.h
@@ -19,10 +19,10 @@ class CFX_CRTFileAccess : public CFX_Retainable {
CFX_RetainPtr<IFX_SeekableStream> CreateFileStream(uint32_t dwModes);
private:
- explicit CFX_CRTFileAccess(const CFX_WideStringC& wsPath);
+ explicit CFX_CRTFileAccess(const WideStringView& wsPath);
~CFX_CRTFileAccess() override;
- CFX_WideString m_path;
+ WideString m_path;
};
#endif // CORE_FXCRT_CFX_CRTFILEACCESS_H_
diff --git a/core/fxcrt/cfx_decimal.cpp b/core/fxcrt/cfx_decimal.cpp
index b900e069a7..45980db6ee 100644
--- a/core/fxcrt/cfx_decimal.cpp
+++ b/core/fxcrt/cfx_decimal.cpp
@@ -294,7 +294,7 @@ CFX_Decimal::CFX_Decimal(float val, uint8_t scale) {
m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(val < 0 && IsNotZero(), scale);
}
-CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) {
+CFX_Decimal::CFX_Decimal(const WideStringView& strObj) {
const wchar_t* str = strObj.unterminated_c_str();
const wchar_t* strBound = str + strObj.GetLength();
bool pointmet = false;
@@ -329,9 +329,9 @@ CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) {
m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(negmet && IsNotZero(), scale);
}
-CFX_Decimal::operator CFX_WideString() const {
- CFX_WideString retString;
- CFX_WideString tmpbuf;
+CFX_Decimal::operator WideString() const {
+ WideString retString;
+ WideString tmpbuf;
uint64_t phi = m_uHi;
uint64_t pmid = m_uMid;
uint64_t plo = m_uLo;
diff --git a/core/fxcrt/cfx_decimal.h b/core/fxcrt/cfx_decimal.h
index 544280444a..de6e3de5e5 100644
--- a/core/fxcrt/cfx_decimal.h
+++ b/core/fxcrt/cfx_decimal.h
@@ -16,9 +16,9 @@ class CFX_Decimal {
explicit CFX_Decimal(uint64_t val);
explicit CFX_Decimal(int32_t val);
CFX_Decimal(float val, uint8_t scale);
- explicit CFX_Decimal(const CFX_WideStringC& str);
+ explicit CFX_Decimal(const WideStringView& str);
- operator CFX_WideString() const;
+ operator WideString() const;
operator double() const;
CFX_Decimal operator*(const CFX_Decimal& val) const;
diff --git a/core/fxcrt/cfx_fileaccess_posix.cpp b/core/fxcrt/cfx_fileaccess_posix.cpp
index 345b6641ef..d98e58dbe9 100644
--- a/core/fxcrt/cfx_fileaccess_posix.cpp
+++ b/core/fxcrt/cfx_fileaccess_posix.cpp
@@ -51,7 +51,7 @@ CFX_FileAccess_Posix::~CFX_FileAccess_Posix() {
Close();
}
-bool CFX_FileAccess_Posix::Open(const CFX_ByteStringC& fileName,
+bool CFX_FileAccess_Posix::Open(const ByteStringView& fileName,
uint32_t dwMode) {
if (m_nFD > -1)
return false;
@@ -65,9 +65,9 @@ bool CFX_FileAccess_Posix::Open(const CFX_ByteStringC& fileName,
return m_nFD > -1;
}
-bool CFX_FileAccess_Posix::Open(const CFX_WideStringC& fileName,
+bool CFX_FileAccess_Posix::Open(const WideStringView& fileName,
uint32_t dwMode) {
- return Open(FX_UTF8Encode(fileName).AsStringC(), dwMode);
+ return Open(FX_UTF8Encode(fileName).AsStringView(), dwMode);
}
void CFX_FileAccess_Posix::Close() {
diff --git a/core/fxcrt/cfx_fileaccess_posix.h b/core/fxcrt/cfx_fileaccess_posix.h
index c299f6cc34..0b739e72d8 100644
--- a/core/fxcrt/cfx_fileaccess_posix.h
+++ b/core/fxcrt/cfx_fileaccess_posix.h
@@ -18,8 +18,8 @@ class CFX_FileAccess_Posix : public IFX_FileAccess {
~CFX_FileAccess_Posix() override;
// IFX_FileAccess:
- bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override;
- bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) override;
+ bool Open(const ByteStringView& fileName, uint32_t dwMode) override;
+ bool Open(const WideStringView& fileName, uint32_t dwMode) override;
void Close() override;
FX_FILESIZE GetSize() const override;
FX_FILESIZE GetPosition() const override;
diff --git a/core/fxcrt/cfx_fileaccess_windows.cpp b/core/fxcrt/cfx_fileaccess_windows.cpp
index b39a4d6efc..105ad788f7 100644
--- a/core/fxcrt/cfx_fileaccess_windows.cpp
+++ b/core/fxcrt/cfx_fileaccess_windows.cpp
@@ -54,7 +54,7 @@ CFX_FileAccess_Windows::~CFX_FileAccess_Windows() {
Close();
}
-bool CFX_FileAccess_Windows::Open(const CFX_ByteStringC& fileName,
+bool CFX_FileAccess_Windows::Open(const ByteStringView& fileName,
uint32_t dwMode) {
if (m_hFile)
return false;
@@ -69,7 +69,7 @@ bool CFX_FileAccess_Windows::Open(const CFX_ByteStringC& fileName,
return !!m_hFile;
}
-bool CFX_FileAccess_Windows::Open(const CFX_WideStringC& fileName,
+bool CFX_FileAccess_Windows::Open(const WideStringView& fileName,
uint32_t dwMode) {
if (m_hFile)
return false;
diff --git a/core/fxcrt/cfx_fileaccess_windows.h b/core/fxcrt/cfx_fileaccess_windows.h
index 692a537a82..f05ab39d6e 100644
--- a/core/fxcrt/cfx_fileaccess_windows.h
+++ b/core/fxcrt/cfx_fileaccess_windows.h
@@ -16,8 +16,8 @@ class CFX_FileAccess_Windows : public IFX_FileAccess {
~CFX_FileAccess_Windows() override;
// IFX_FileAccess
- bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override;
- bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) override;
+ bool Open(const ByteStringView& fileName, uint32_t dwMode) override;
+ bool Open(const WideStringView& fileName, uint32_t dwMode) override;
void Close() override;
FX_FILESIZE GetSize() const override;
FX_FILESIZE GetPosition() const override;
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp
index d3516e1794..6a6c6e6c3e 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.cpp
+++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -269,7 +269,7 @@ FX_STRSIZE CFX_SeekableStreamProxy::ReadString(wchar_t* pStr,
return iMaxLength;
}
-void CFX_SeekableStreamProxy::WriteString(const CFX_WideStringC& str) {
+void CFX_SeekableStreamProxy::WriteString(const WideStringView& str) {
if (!m_IsWriteStream || str.GetLength() == 0 ||
m_wCodePage != FX_CODEPAGE_UTF8) {
return;
diff --git a/core/fxcrt/cfx_seekablestreamproxy.h b/core/fxcrt/cfx_seekablestreamproxy.h
index 0e427fc79b..fc041b49b5 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.h
+++ b/core/fxcrt/cfx_seekablestreamproxy.h
@@ -31,7 +31,7 @@ class CFX_SeekableStreamProxy : public CFX_Retainable {
void Seek(From eSeek, FX_FILESIZE iOffset);
FX_STRSIZE ReadString(wchar_t* pStr, FX_STRSIZE iMaxLength, bool* bEOS);
- void WriteString(const CFX_WideStringC& str);
+ void WriteString(const WideStringView& str);
uint16_t GetCodePage() const { return m_wCodePage; }
void SetCodePage(uint16_t wCodePage);
diff --git a/core/fxcrt/cfx_string_pool_template.h b/core/fxcrt/cfx_string_pool_template.h
index bfc1ce4bfb..b170a84127 100644
--- a/core/fxcrt/cfx_string_pool_template.h
+++ b/core/fxcrt/cfx_string_pool_template.h
@@ -21,10 +21,10 @@ class CFX_StringPoolTemplate {
std::unordered_set<StringType> m_Pool;
};
-using CFX_ByteStringPool = CFX_StringPoolTemplate<CFX_ByteString>;
-using CFX_WideStringPool = CFX_StringPoolTemplate<CFX_WideString>;
+using ByteStringPool = CFX_StringPoolTemplate<ByteString>;
+using WideStringPool = CFX_StringPoolTemplate<WideString>;
-extern template class CFX_StringPoolTemplate<CFX_ByteString>;
-extern template class CFX_StringPoolTemplate<CFX_WideString>;
+extern template class CFX_StringPoolTemplate<ByteString>;
+extern template class CFX_StringPoolTemplate<WideString>;
#endif // CORE_FXCRT_CFX_STRING_POOL_TEMPLATE_H_
diff --git a/core/fxcrt/cfx_string_pool_template_unittest.cpp b/core/fxcrt/cfx_string_pool_template_unittest.cpp
index a4e603c8fa..9a5ac5d3ed 100644
--- a/core/fxcrt/cfx_string_pool_template_unittest.cpp
+++ b/core/fxcrt/cfx_string_pool_template_unittest.cpp
@@ -7,22 +7,22 @@
#include "testing/gtest/include/gtest/gtest.h"
TEST(fxcrt, ByteStringPool) {
- CFX_ByteStringPool pool;
+ ByteStringPool pool;
- CFX_ByteString null1;
- CFX_ByteString null2;
- CFX_ByteString goats1("goats");
- CFX_ByteString goats2("goats");
+ ByteString null1;
+ ByteString null2;
+ ByteString goats1("goats");
+ ByteString goats2("goats");
// Underlying storage, if non-null, is not shared.
EXPECT_EQ(nullptr, null1.m_pData.Get());
EXPECT_EQ(nullptr, null2.m_pData.Get());
EXPECT_NE(goats1.m_pData, goats2.m_pData);
- CFX_ByteString interned_null1 = pool.Intern(null1);
- CFX_ByteString interned_null2 = pool.Intern(null2);
- CFX_ByteString interned_goats1 = pool.Intern(goats1);
- CFX_ByteString interned_goats2 = pool.Intern(goats2);
+ ByteString interned_null1 = pool.Intern(null1);
+ ByteString interned_null2 = pool.Intern(null2);
+ ByteString interned_goats1 = pool.Intern(goats1);
+ ByteString interned_goats2 = pool.Intern(goats2);
// Strings are logically equal after being interned.
EXPECT_EQ(null1, interned_null1);
@@ -37,10 +37,10 @@ TEST(fxcrt, ByteStringPool) {
EXPECT_EQ(goats1.m_pData, interned_goats2.m_pData);
pool.Clear();
- CFX_ByteString reinterned_null2 = pool.Intern(null2);
- CFX_ByteString reinterned_null1 = pool.Intern(null2);
- CFX_ByteString reinterned_goats2 = pool.Intern(goats2);
- CFX_ByteString reinterned_goats1 = pool.Intern(goats2);
+ ByteString reinterned_null2 = pool.Intern(null2);
+ ByteString reinterned_null1 = pool.Intern(null2);
+ ByteString reinterned_goats2 = pool.Intern(goats2);
+ ByteString reinterned_goats1 = pool.Intern(goats2);
// After clearing pool, storage was re-interned using second strings.
EXPECT_EQ(nullptr, interned_null1.m_pData.Get());
@@ -50,22 +50,22 @@ TEST(fxcrt, ByteStringPool) {
}
TEST(fxcrt, WideStringPool) {
- CFX_WideStringPool pool;
+ WideStringPool pool;
- CFX_WideString null1;
- CFX_WideString null2;
- CFX_WideString goats1(L"goats");
- CFX_WideString goats2(L"goats");
+ WideString null1;
+ WideString null2;
+ WideString goats1(L"goats");
+ WideString goats2(L"goats");
// Underlying storage, if non-null, is not shared.
EXPECT_EQ(nullptr, null1.m_pData.Get());
EXPECT_EQ(nullptr, null2.m_pData.Get());
EXPECT_NE(goats1.m_pData, goats2.m_pData);
- CFX_WideString interned_null1 = pool.Intern(null1);
- CFX_WideString interned_null2 = pool.Intern(null2);
- CFX_WideString interned_goats1 = pool.Intern(goats1);
- CFX_WideString interned_goats2 = pool.Intern(goats2);
+ WideString interned_null1 = pool.Intern(null1);
+ WideString interned_null2 = pool.Intern(null2);
+ WideString interned_goats1 = pool.Intern(goats1);
+ WideString interned_goats2 = pool.Intern(goats2);
// Strings are logically equal after being interned.
EXPECT_EQ(null1, interned_null1);
@@ -80,10 +80,10 @@ TEST(fxcrt, WideStringPool) {
EXPECT_EQ(goats1.m_pData, interned_goats2.m_pData);
pool.Clear();
- CFX_WideString reinterned_null2 = pool.Intern(null2);
- CFX_WideString reinterned_null1 = pool.Intern(null2);
- CFX_WideString reinterned_goats2 = pool.Intern(goats2);
- CFX_WideString reinterned_goats1 = pool.Intern(goats2);
+ WideString reinterned_null2 = pool.Intern(null2);
+ WideString reinterned_null1 = pool.Intern(null2);
+ WideString reinterned_goats2 = pool.Intern(goats2);
+ WideString reinterned_goats1 = pool.Intern(goats2);
// After clearing pool, storage was re-interned using second strings.
EXPECT_EQ(nullptr, interned_null1.m_pData.Get());
diff --git a/core/fxcrt/cfx_utf8decoder.h b/core/fxcrt/cfx_utf8decoder.h
index dcf5ef796a..1cafbe4472 100644
--- a/core/fxcrt/cfx_utf8decoder.h
+++ b/core/fxcrt/cfx_utf8decoder.h
@@ -17,7 +17,7 @@ class CFX_UTF8Decoder {
void Input(uint8_t byte);
void AppendCodePoint(uint32_t ch);
void ClearStatus() { m_PendingBytes = 0; }
- CFX_WideStringC GetResult() const { return m_Buffer.AsStringC(); }
+ WideStringView GetResult() const { return m_Buffer.AsStringView(); }
private:
int m_PendingBytes;
diff --git a/core/fxcrt/cfx_widestring.h b/core/fxcrt/cfx_widestring.h
deleted file mode 100644
index 595615a0b2..0000000000
--- a/core/fxcrt/cfx_widestring.h
+++ /dev/null
@@ -1,276 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FXCRT_CFX_WIDESTRING_H_
-#define CORE_FXCRT_CFX_WIDESTRING_H_
-
-#include <functional>
-#include <iterator>
-#include <utility>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/cfx_string_c_template.h"
-#include "core/fxcrt/cfx_string_data_template.h"
-#include "core/fxcrt/fx_memory.h"
-#include "core/fxcrt/fx_system.h"
-#include "third_party/base/optional.h"
-
-class CFX_ByteString;
-
-// A mutable string with shared buffers using copy-on-write semantics that
-// avoids the cost of std::string's iterator stability guarantees.
-class CFX_WideString {
- public:
- using CharType = wchar_t;
- using const_iterator = const CharType*;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
- CFX_WideString();
- CFX_WideString(const CFX_WideString& other);
- CFX_WideString(CFX_WideString&& other) noexcept;
-
- // Deliberately implicit to avoid calling on every string literal.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_WideString(wchar_t ch);
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_WideString(const wchar_t* ptr);
-
- // No implicit conversions from byte strings.
- // NOLINTNEXTLINE(runtime/explicit)
- CFX_WideString(char) = delete;
-
- CFX_WideString(const wchar_t* ptr, FX_STRSIZE len);
-
- explicit CFX_WideString(const CFX_WideStringC& str);
- CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2);
- CFX_WideString(const std::initializer_list<CFX_WideStringC>& list);
-
- ~CFX_WideString();
-
- static CFX_WideString FromLocal(const CFX_ByteStringC& str);
- static CFX_WideString FromCodePage(const CFX_ByteStringC& str,
- uint16_t codepage);
-
- static CFX_WideString FromUTF8(const CFX_ByteStringC& str);
- static CFX_WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len);
-
- static FX_STRSIZE WStringLength(const unsigned short* str);
-
- // Explicit conversion to C-style wide string.
- // Note: Any subsequent modification of |this| will invalidate the result.
- const wchar_t* c_str() const { return m_pData ? m_pData->m_String : L""; }
-
- // Explicit conversion to CFX_WideStringC.
- // Note: Any subsequent modification of |this| will invalidate the result.
- CFX_WideStringC AsStringC() const {
- return CFX_WideStringC(c_str(), GetLength());
- }
-
- // Note: Any subsequent modification of |this| will invalidate iterators.
- const_iterator begin() const { return m_pData ? m_pData->m_String : nullptr; }
- const_iterator end() const {
- return m_pData ? m_pData->m_String + m_pData->m_nDataLength : nullptr;
- }
-
- // Note: Any subsequent modification of |this| will invalidate iterators.
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
-
- void clear() { m_pData.Reset(); }
-
- FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
- FX_STRSIZE GetStringLength() const {
- return m_pData ? FXSYS_wcslen(m_pData->m_String) : 0;
- }
- bool IsEmpty() const { return !GetLength(); }
- bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
- bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
-
- const CFX_WideString& operator=(const wchar_t* str);
- const CFX_WideString& operator=(const CFX_WideString& stringSrc);
- const CFX_WideString& operator=(const CFX_WideStringC& stringSrc);
-
- const CFX_WideString& operator+=(const wchar_t* str);
- const CFX_WideString& operator+=(wchar_t ch);
- const CFX_WideString& operator+=(const CFX_WideString& str);
- const CFX_WideString& operator+=(const CFX_WideStringC& str);
-
- bool operator==(const wchar_t* ptr) const;
- bool operator==(const CFX_WideStringC& str) const;
- bool operator==(const CFX_WideString& other) const;
-
- bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); }
- bool operator!=(const CFX_WideStringC& str) const { return !(*this == str); }
- bool operator!=(const CFX_WideString& other) const {
- return !(*this == other);
- }
-
- bool operator<(const CFX_WideString& str) const;
-
- CharType operator[](const FX_STRSIZE index) const {
- ASSERT(IsValidIndex(index));
- return m_pData ? m_pData->m_String[index] : 0;
- }
-
- CharType First() const { return GetLength() ? (*this)[0] : 0; }
- CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
-
- void SetAt(FX_STRSIZE index, wchar_t c);
-
- int Compare(const wchar_t* str) const;
- int Compare(const CFX_WideString& str) const;
- int CompareNoCase(const wchar_t* str) const;
-
- CFX_WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
- CFX_WideString Left(FX_STRSIZE count) const;
- CFX_WideString Right(FX_STRSIZE count) const;
-
- FX_STRSIZE Insert(FX_STRSIZE index, wchar_t ch);
- FX_STRSIZE InsertAtFront(wchar_t ch) { return Insert(0, ch); }
- FX_STRSIZE InsertAtBack(wchar_t ch) { return Insert(GetLength(), ch); }
- FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
-
- void Format(const wchar_t* lpszFormat, ...);
- void FormatV(const wchar_t* lpszFormat, va_list argList);
-
- void MakeLower();
- void MakeUpper();
-
- void TrimRight();
- void TrimRight(wchar_t chTarget);
- void TrimRight(const CFX_WideStringC& pTargets);
-
- void TrimLeft();
- void TrimLeft(wchar_t chTarget);
- void TrimLeft(const CFX_WideStringC& pTargets);
-
- void Reserve(FX_STRSIZE len);
- wchar_t* GetBuffer(FX_STRSIZE len);
- void ReleaseBuffer(FX_STRSIZE len);
-
- int GetInteger() const;
- float GetFloat() const;
-
- pdfium::Optional<FX_STRSIZE> Find(const CFX_WideStringC& pSub,
- FX_STRSIZE start = 0) const;
- pdfium::Optional<FX_STRSIZE> Find(wchar_t ch, FX_STRSIZE start = 0) const;
-
- bool Contains(const CFX_WideStringC& lpszSub, FX_STRSIZE start = 0) const {
- return Find(lpszSub, start).has_value();
- }
-
- bool Contains(char ch, FX_STRSIZE start = 0) const {
- return Find(ch, start).has_value();
- }
-
- FX_STRSIZE Replace(const CFX_WideStringC& pOld, const CFX_WideStringC& pNew);
- FX_STRSIZE Remove(wchar_t ch);
-
- CFX_ByteString UTF8Encode() const;
- CFX_ByteString UTF16LE_Encode() const;
-
- protected:
- using StringData = CFX_StringDataTemplate<wchar_t>;
-
- void ReallocBeforeWrite(FX_STRSIZE nLen);
- void AllocBeforeWrite(FX_STRSIZE nLen);
- void AllocCopy(CFX_WideString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const;
- void AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen);
- void Concat(const wchar_t* lpszSrcData, FX_STRSIZE nSrcLen);
-
- // Returns true unless we ran out of space.
- bool TryVSWPrintf(FX_STRSIZE size, const wchar_t* format, va_list argList);
-
- CFX_RetainPtr<StringData> m_pData;
-
- friend class fxcrt_WideStringConcatInPlace_Test;
- friend class fxcrt_WideStringPool_Test;
-};
-
-inline CFX_WideString operator+(const CFX_WideStringC& str1,
- const CFX_WideStringC& str2) {
- return CFX_WideString(str1, str2);
-}
-inline CFX_WideString operator+(const CFX_WideStringC& str1,
- const wchar_t* str2) {
- return CFX_WideString(str1, str2);
-}
-inline CFX_WideString operator+(const wchar_t* str1,
- const CFX_WideStringC& str2) {
- return CFX_WideString(str1, str2);
-}
-inline CFX_WideString operator+(const CFX_WideStringC& str1, wchar_t ch) {
- return CFX_WideString(str1, CFX_WideStringC(ch));
-}
-inline CFX_WideString operator+(wchar_t ch, const CFX_WideStringC& str2) {
- return CFX_WideString(ch, str2);
-}
-inline CFX_WideString operator+(const CFX_WideString& str1,
- const CFX_WideString& str2) {
- return CFX_WideString(str1.AsStringC(), str2.AsStringC());
-}
-inline CFX_WideString operator+(const CFX_WideString& str1, wchar_t ch) {
- return CFX_WideString(str1.AsStringC(), CFX_WideStringC(ch));
-}
-inline CFX_WideString operator+(wchar_t ch, const CFX_WideString& str2) {
- return CFX_WideString(ch, str2.AsStringC());
-}
-inline CFX_WideString operator+(const CFX_WideString& str1,
- const wchar_t* str2) {
- return CFX_WideString(str1.AsStringC(), str2);
-}
-inline CFX_WideString operator+(const wchar_t* str1,
- const CFX_WideString& str2) {
- return CFX_WideString(str1, str2.AsStringC());
-}
-inline CFX_WideString operator+(const CFX_WideString& str1,
- const CFX_WideStringC& str2) {
- return CFX_WideString(str1.AsStringC(), str2);
-}
-inline CFX_WideString operator+(const CFX_WideStringC& str1,
- const CFX_WideString& str2) {
- return CFX_WideString(str1, str2.AsStringC());
-}
-inline bool operator==(const wchar_t* lhs, const CFX_WideString& rhs) {
- return rhs == lhs;
-}
-inline bool operator==(const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
- return rhs == lhs;
-}
-inline bool operator!=(const wchar_t* lhs, const CFX_WideString& rhs) {
- return rhs != lhs;
-}
-inline bool operator!=(const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
- return rhs != lhs;
-}
-
-uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase);
-
-std::wostream& operator<<(std::wostream& os, const CFX_WideString& str);
-std::ostream& operator<<(std::ostream& os, const CFX_WideString& str);
-std::wostream& operator<<(std::wostream& os, const CFX_WideStringC& str);
-std::ostream& operator<<(std::ostream& os, const CFX_WideStringC& str);
-
-namespace std {
-
-template <>
-struct hash<CFX_WideString> {
- std::size_t operator()(const CFX_WideString& str) const {
- return FX_HashCode_GetW(str.AsStringC(), false);
- }
-};
-
-} // namespace std
-
-extern template struct std::hash<CFX_WideString>;
-
-#endif // CORE_FXCRT_CFX_WIDESTRING_H_
diff --git a/core/fxcrt/cfx_widetextbuf.cpp b/core/fxcrt/cfx_widetextbuf.cpp
index 81b5fd4b05..d51e5ea314 100644
--- a/core/fxcrt/cfx_widetextbuf.cpp
+++ b/core/fxcrt/cfx_widetextbuf.cpp
@@ -16,12 +16,12 @@ void CFX_WideTextBuf::AppendChar(wchar_t ch) {
m_DataSize += sizeof(wchar_t);
}
-CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideStringC& str) {
+CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const WideStringView& str) {
AppendBlock(str.unterminated_c_str(), str.GetLength() * sizeof(wchar_t));
return *this;
}
-CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideString& str) {
+CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const WideString& str) {
AppendBlock(str.c_str(), str.GetLength() * sizeof(wchar_t));
return *this;
}
diff --git a/core/fxcrt/cfx_widetextbuf.h b/core/fxcrt/cfx_widetextbuf.h
index 389f2e52a3..77fe4141f9 100644
--- a/core/fxcrt/cfx_widetextbuf.h
+++ b/core/fxcrt/cfx_widetextbuf.h
@@ -19,14 +19,14 @@ class CFX_WideTextBuf : public CFX_BinaryBuf {
return reinterpret_cast<wchar_t*>(m_pBuffer.get());
}
- CFX_WideStringC AsStringC() const {
- return CFX_WideStringC(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
- m_DataSize / sizeof(wchar_t));
- }
- CFX_WideString MakeString() const {
- return CFX_WideString(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
+ WideStringView AsStringView() const {
+ return WideStringView(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
m_DataSize / sizeof(wchar_t));
}
+ WideString MakeString() const {
+ return WideString(reinterpret_cast<const wchar_t*>(m_pBuffer.get()),
+ m_DataSize / sizeof(wchar_t));
+ }
void Delete(int start_index, int count) {
CFX_BinaryBuf::Delete(start_index * sizeof(wchar_t),
@@ -36,8 +36,8 @@ class CFX_WideTextBuf : public CFX_BinaryBuf {
CFX_WideTextBuf& operator<<(int i);
CFX_WideTextBuf& operator<<(double f);
CFX_WideTextBuf& operator<<(const wchar_t* lpsz);
- CFX_WideTextBuf& operator<<(const CFX_WideStringC& str);
- CFX_WideTextBuf& operator<<(const CFX_WideString& str);
+ CFX_WideTextBuf& operator<<(const WideStringView& str);
+ CFX_WideTextBuf& operator<<(const WideString& str);
CFX_WideTextBuf& operator<<(const CFX_WideTextBuf& buf);
};
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.cpp b/core/fxcrt/css/cfx_csscomputedstyle.cpp
index 953c107ec3..aae88a364a 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.cpp
+++ b/core/fxcrt/css/cfx_csscomputedstyle.cpp
@@ -14,8 +14,8 @@ CFX_CSSComputedStyle::CFX_CSSComputedStyle() {}
CFX_CSSComputedStyle::~CFX_CSSComputedStyle() {}
-bool CFX_CSSComputedStyle::GetCustomStyle(const CFX_WideString& wsName,
- CFX_WideString& wsValue) const {
+bool CFX_CSSComputedStyle::GetCustomStyle(const WideString& wsName,
+ WideString& wsValue) const {
for (auto iter = m_CustomProperties.rbegin();
iter != m_CustomProperties.rend(); iter++) {
if (wsName == iter->name()) {
@@ -32,7 +32,7 @@ int32_t CFX_CSSComputedStyle::CountFontFamilies() const {
: 0;
}
-const CFX_WideString CFX_CSSComputedStyle::GetFontFamily(int32_t index) const {
+const WideString CFX_CSSComputedStyle::GetFontFamily(int32_t index) const {
return m_InheritedData.m_pFontFamily->GetValue(index)
.As<CFX_CSSStringValue>()
->Value();
diff --git a/core/fxcrt/css/cfx_csscomputedstyle.h b/core/fxcrt/css/cfx_csscomputedstyle.h
index bb4b62bc2b..b05339ac02 100644
--- a/core/fxcrt/css/cfx_csscomputedstyle.h
+++ b/core/fxcrt/css/cfx_csscomputedstyle.h
@@ -56,7 +56,7 @@ class CFX_CSSComputedStyle : public CFX_Retainable {
};
int32_t CountFontFamilies() const;
- const CFX_WideString GetFontFamily(int32_t index) const;
+ const WideString GetFontFamily(int32_t index) const;
uint16_t GetFontWeight() const;
CFX_CSSFontVariant GetFontVariant() const;
CFX_CSSFontStyle GetFontStyle() const;
@@ -91,8 +91,7 @@ class CFX_CSSComputedStyle : public CFX_Retainable {
void SetLetterSpacing(const CFX_CSSLength& letterSpacing);
void AddCustomStyle(const CFX_CSSCustomProperty& prop);
- bool GetCustomStyle(const CFX_WideString& wsName,
- CFX_WideString& wsValue) const;
+ bool GetCustomStyle(const WideString& wsName, WideString& wsValue) const;
InheritedData m_InheritedData;
NonInheritedData m_NonInheritedData;
diff --git a/core/fxcrt/css/cfx_csscustomproperty.cpp b/core/fxcrt/css/cfx_csscustomproperty.cpp
index 8bfb9d961e..353facd5f0 100644
--- a/core/fxcrt/css/cfx_csscustomproperty.cpp
+++ b/core/fxcrt/css/cfx_csscustomproperty.cpp
@@ -4,8 +4,8 @@
#include "core/fxcrt/css/cfx_csscustomproperty.h"
-CFX_CSSCustomProperty::CFX_CSSCustomProperty(const CFX_WideString& name,
- const CFX_WideString& value)
+CFX_CSSCustomProperty::CFX_CSSCustomProperty(const WideString& name,
+ const WideString& value)
: name_(name), value_(value) {}
CFX_CSSCustomProperty::CFX_CSSCustomProperty(const CFX_CSSCustomProperty& prop)
diff --git a/core/fxcrt/css/cfx_csscustomproperty.h b/core/fxcrt/css/cfx_csscustomproperty.h
index e062c3e953..15c3eca124 100644
--- a/core/fxcrt/css/cfx_csscustomproperty.h
+++ b/core/fxcrt/css/cfx_csscustomproperty.h
@@ -11,17 +11,16 @@
class CFX_CSSCustomProperty {
public:
- CFX_CSSCustomProperty(const CFX_WideString& name,
- const CFX_WideString& value);
+ CFX_CSSCustomProperty(const WideString& name, const WideString& value);
CFX_CSSCustomProperty(const CFX_CSSCustomProperty& prop);
~CFX_CSSCustomProperty();
- CFX_WideString name() const { return name_; }
- CFX_WideString value() const { return value_; }
+ WideString name() const { return name_; }
+ WideString value() const { return value_; }
private:
- CFX_WideString name_;
- CFX_WideString value_;
+ WideString name_;
+ WideString value_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSCUSTOMPROPERTY_H_
diff --git a/core/fxcrt/css/cfx_cssdatatable.cpp b/core/fxcrt/css/cfx_cssdatatable.cpp
index 833b81b93b..53617b6a48 100644
--- a/core/fxcrt/css/cfx_cssdatatable.cpp
+++ b/core/fxcrt/css/cfx_cssdatatable.cpp
@@ -122,7 +122,7 @@ static_assert(g_iCSSPropertyCount ==
"Property table differs in size from property enum");
const CFX_CSSPropertyTable* CFX_GetCSSPropertyByName(
- const CFX_WideStringC& wsName) {
+ const WideStringView& wsName) {
ASSERT(!wsName.IsEmpty());
uint32_t dwHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd = g_iCSSPropertyCount;
diff --git a/core/fxcrt/css/cfx_cssdatatable.h b/core/fxcrt/css/cfx_cssdatatable.h
index 43310c7d5c..63c303488e 100644
--- a/core/fxcrt/css/cfx_cssdatatable.h
+++ b/core/fxcrt/css/cfx_cssdatatable.h
@@ -23,7 +23,7 @@ struct CFX_CSSPropertyTable {
};
const CFX_CSSPropertyTable* CFX_GetCSSPropertyByName(
- const CFX_WideStringC& wsName);
+ const WideStringView& wsName);
const CFX_CSSPropertyTable* CFX_GetCSSPropertyByEnum(CFX_CSSProperty eName);
#endif // CORE_FXCRT_CSS_CFX_CSSDATATABLE_H_
diff --git a/core/fxcrt/css/cfx_cssdeclaration.cpp b/core/fxcrt/css/cfx_cssdeclaration.cpp
index 344fc842c4..f2c7d3930b 100644
--- a/core/fxcrt/css/cfx_cssdeclaration.cpp
+++ b/core/fxcrt/css/cfx_cssdeclaration.cpp
@@ -113,7 +113,7 @@ const CFX_CSSColorTable g_CFX_CSSColors[] = {
};
const CFX_CSSPropertyValueTable* GetCSSPropertyValueByName(
- const CFX_WideStringC& wsName) {
+ const WideStringView& wsName) {
ASSERT(!wsName.IsEmpty());
uint32_t dwHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd = g_iCSSPropertyValueCount;
@@ -134,7 +134,7 @@ const CFX_CSSPropertyValueTable* GetCSSPropertyValueByName(
}
const CFX_CSSLengthUnitTable* GetCSSLengthUnitByName(
- const CFX_WideStringC& wsName) {
+ const WideStringView& wsName) {
ASSERT(!wsName.IsEmpty());
uint16_t wHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd =
@@ -155,7 +155,7 @@ const CFX_CSSLengthUnitTable* GetCSSLengthUnitByName(
return nullptr;
}
-const CFX_CSSColorTable* GetCSSColorByName(const CFX_WideStringC& wsName) {
+const CFX_CSSColorTable* GetCSSColorByName(const WideStringView& wsName) {
ASSERT(!wsName.IsEmpty());
uint32_t dwHash = FX_HashCode_GetW(wsName, true);
int32_t iEnd = sizeof(g_CFX_CSSColors) / sizeof(CFX_CSSColorTable) - 1;
@@ -192,7 +192,7 @@ bool ParseCSSNumber(const wchar_t* pszValue,
eUnit = CFX_CSSNumberType::Percent;
} else if (iValueLen == 2) {
const CFX_CSSLengthUnitTable* pUnit =
- GetCSSLengthUnitByName(CFX_WideStringC(pszValue, 2));
+ GetCSSLengthUnitByName(WideStringView(pszValue, 2));
if (pUnit)
eUnit = pUnit->wValue;
}
@@ -273,7 +273,7 @@ bool CFX_CSSDeclaration::ParseCSSColor(const wchar_t* pszValue,
}
const CFX_CSSColorTable* pColor =
- GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSColorByName(WideStringView(pszValue, iValueLen));
if (!pColor)
return false;
@@ -308,7 +308,7 @@ void CFX_CSSDeclaration::AddPropertyHolder(CFX_CSSProperty eProperty,
}
void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable,
- const CFX_WideStringC& value) {
+ const WideStringView& value) {
ASSERT(!value.IsEmpty());
const wchar_t* pszValue = value.unterminated_c_str();
@@ -422,8 +422,8 @@ void CFX_CSSDeclaration::AddProperty(const CFX_CSSPropertyTable* pTable,
}
}
-void CFX_CSSDeclaration::AddProperty(const CFX_WideString& prop,
- const CFX_WideString& value) {
+void CFX_CSSDeclaration::AddProperty(const WideString& prop,
+ const WideString& value) {
custom_properties_.push_back(
pdfium::MakeUnique<CFX_CSSCustomProperty>(prop, value));
}
@@ -442,7 +442,7 @@ CFX_RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseEnum(
const wchar_t* pszValue,
int32_t iValueLen) {
const CFX_CSSPropertyValueTable* pValue =
- GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen));
return pValue ? pdfium::MakeRetain<CFX_CSSEnumValue>(pValue->eName) : nullptr;
}
@@ -466,7 +466,7 @@ CFX_RetainPtr<CFX_CSSValue> CFX_CSSDeclaration::ParseString(
return nullptr;
return pdfium::MakeRetain<CFX_CSSStringValue>(
- CFX_WideString(pszValue + iOffset, iValueLen));
+ WideString(pszValue + iOffset, iValueLen));
}
void CFX_CSSDeclaration::ParseValueListProperty(
@@ -502,7 +502,7 @@ void CFX_CSSDeclaration::ParseValueListProperty(
}
if (dwType & CFX_CSSVALUETYPE_MaybeEnum) {
const CFX_CSSPropertyValueTable* pValue =
- GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen));
if (pValue) {
list.push_back(pdfium::MakeRetain<CFX_CSSEnumValue>(pValue->eName));
continue;
@@ -510,7 +510,7 @@ void CFX_CSSDeclaration::ParseValueListProperty(
}
if (dwType & CFX_CSSVALUETYPE_MaybeString) {
list.push_back(pdfium::MakeRetain<CFX_CSSStringValue>(
- CFX_WideString(pszValue, iValueLen)));
+ WideString(pszValue, iValueLen)));
}
break;
case CFX_CSSPrimitiveType::RGB:
@@ -614,12 +614,12 @@ bool CFX_CSSDeclaration::ParseBorderProperty(
}
case CFX_CSSPrimitiveType::String: {
const CFX_CSSColorTable* pColorItem =
- GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSColorByName(WideStringView(pszValue, iValueLen));
if (pColorItem)
continue;
const CFX_CSSPropertyValueTable* pValue =
- GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen));
if (!pValue)
continue;
@@ -661,7 +661,7 @@ void CFX_CSSDeclaration::ParseFontProperty(const wchar_t* pszValue,
switch (eType) {
case CFX_CSSPrimitiveType::String: {
const CFX_CSSPropertyValueTable* pValue =
- GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen));
+ GetCSSPropertyValueByName(WideStringView(pszValue, iValueLen));
if (pValue) {
switch (pValue->eName) {
case CFX_CSSPropertyValue::XxSmall:
@@ -710,7 +710,7 @@ void CFX_CSSDeclaration::ParseFontProperty(const wchar_t* pszValue,
}
if (pFontSize) {
familyList.push_back(pdfium::MakeRetain<CFX_CSSStringValue>(
- CFX_WideString(pszValue, iValueLen)));
+ WideString(pszValue, iValueLen)));
}
parser.m_Separator = ',';
break;
diff --git a/core/fxcrt/css/cfx_cssdeclaration.h b/core/fxcrt/css/cfx_cssdeclaration.h
index 7b39daef7e..dba1d44fc7 100644
--- a/core/fxcrt/css/cfx_cssdeclaration.h
+++ b/core/fxcrt/css/cfx_cssdeclaration.h
@@ -48,8 +48,8 @@ class CFX_CSSDeclaration {
bool empty() const { return properties_.empty(); }
void AddProperty(const CFX_CSSPropertyTable* pTable,
- const CFX_WideStringC& value);
- void AddProperty(const CFX_WideString& prop, const CFX_WideString& value);
+ const WideStringView& value);
+ void AddProperty(const WideString& prop, const WideString& value);
size_t PropertyCountForTesting() const;
diff --git a/core/fxcrt/css/cfx_cssrulecollection.cpp b/core/fxcrt/css/cfx_cssrulecollection.cpp
index 635ca91c72..2030518b69 100644
--- a/core/fxcrt/css/cfx_cssrulecollection.cpp
+++ b/core/fxcrt/css/cfx_cssrulecollection.cpp
@@ -28,7 +28,7 @@ void CFX_CSSRuleCollection::Clear() {
}
const std::vector<std::unique_ptr<CFX_CSSRuleCollection::Data>>*
-CFX_CSSRuleCollection::GetTagRuleData(const CFX_WideString& tagname) const {
+CFX_CSSRuleCollection::GetTagRuleData(const WideString& tagname) const {
auto it = m_TagRules.find(FX_HashCode_GetW(tagname.c_str(), true));
return it != m_TagRules.end() ? &it->second : nullptr;
}
diff --git a/core/fxcrt/css/cfx_cssrulecollection.h b/core/fxcrt/css/cfx_cssrulecollection.h
index 6b91c6bcd5..72ae58c55f 100644
--- a/core/fxcrt/css/cfx_cssrulecollection.h
+++ b/core/fxcrt/css/cfx_cssrulecollection.h
@@ -36,7 +36,7 @@ class CFX_CSSRuleCollection {
int32_t CountSelectors() const { return m_iSelectors; }
const std::vector<std::unique_ptr<Data>>* GetTagRuleData(
- const CFX_WideString& tagname) const;
+ const WideString& tagname) const;
private:
void AddRulesFrom(const CFX_CSSStyleSheet* pStyleSheet,
diff --git a/core/fxcrt/css/cfx_cssselector.cpp b/core/fxcrt/css/cfx_cssselector.cpp
index 6ee81f5610..3993dcae5c 100644
--- a/core/fxcrt/css/cfx_cssselector.cpp
+++ b/core/fxcrt/css/cfx_cssselector.cpp
@@ -31,7 +31,7 @@ CFX_CSSSelector::CFX_CSSSelector(CFX_CSSSelectorType eType,
int32_t iLen,
bool bIgnoreCase)
: m_eType(eType),
- m_dwHash(FX_HashCode_GetW(CFX_WideStringC(psz, iLen), bIgnoreCase)) {}
+ m_dwHash(FX_HashCode_GetW(WideStringView(psz, iLen), bIgnoreCase)) {}
CFX_CSSSelector::~CFX_CSSSelector() {}
@@ -49,7 +49,7 @@ CFX_CSSSelector* CFX_CSSSelector::GetNextSelector() const {
// static.
std::unique_ptr<CFX_CSSSelector> CFX_CSSSelector::FromString(
- const CFX_WideStringC& str) {
+ const WideStringView& str) {
ASSERT(!str.IsEmpty());
const wchar_t* psz = str.unterminated_c_str();
diff --git a/core/fxcrt/css/cfx_cssselector.h b/core/fxcrt/css/cfx_cssselector.h
index 9fff42a850..62f8b166cc 100644
--- a/core/fxcrt/css/cfx_cssselector.h
+++ b/core/fxcrt/css/cfx_cssselector.h
@@ -15,8 +15,7 @@
class CFX_CSSSelector {
public:
- static std::unique_ptr<CFX_CSSSelector> FromString(
- const CFX_WideStringC& str);
+ static std::unique_ptr<CFX_CSSSelector> FromString(const WideStringView& str);
CFX_CSSSelector(CFX_CSSSelectorType eType,
const wchar_t* psz,
diff --git a/core/fxcrt/css/cfx_cssstringvalue.cpp b/core/fxcrt/css/cfx_cssstringvalue.cpp
index b66c54505f..6ff2a33c9b 100644
--- a/core/fxcrt/css/cfx_cssstringvalue.cpp
+++ b/core/fxcrt/css/cfx_cssstringvalue.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/css/cfx_cssstringvalue.h"
-CFX_CSSStringValue::CFX_CSSStringValue(const CFX_WideString& value)
+CFX_CSSStringValue::CFX_CSSStringValue(const WideString& value)
: CFX_CSSValue(CFX_CSSPrimitiveType::String), value_(value) {}
CFX_CSSStringValue::~CFX_CSSStringValue() {}
diff --git a/core/fxcrt/css/cfx_cssstringvalue.h b/core/fxcrt/css/cfx_cssstringvalue.h
index 7680360973..d72078a630 100644
--- a/core/fxcrt/css/cfx_cssstringvalue.h
+++ b/core/fxcrt/css/cfx_cssstringvalue.h
@@ -11,13 +11,13 @@
class CFX_CSSStringValue : public CFX_CSSValue {
public:
- explicit CFX_CSSStringValue(const CFX_WideString& value);
+ explicit CFX_CSSStringValue(const WideString& value);
~CFX_CSSStringValue() override;
- const CFX_WideString Value() const { return value_; }
+ const WideString Value() const { return value_; }
private:
- const CFX_WideString value_;
+ const WideString value_;
};
#endif // CORE_FXCRT_CSS_CFX_CSSSTRINGVALUE_H_
diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp
index 9a2bc8c498..9ae2b876f7 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.cpp
+++ b/core/fxcrt/css/cfx_cssstyleselector.cpp
@@ -50,7 +50,7 @@ void CFX_CSSStyleSelector::UpdateStyleIndex() {
}
std::vector<const CFX_CSSDeclaration*> CFX_CSSStyleSelector::MatchDeclarations(
- const CFX_WideString& tagname) {
+ const WideString& tagname) {
std::vector<const CFX_CSSDeclaration*> matchedDecls;
if (m_UARules.CountSelectors() == 0 || tagname.IsEmpty())
return matchedDecls;
@@ -66,7 +66,7 @@ std::vector<const CFX_CSSDeclaration*> CFX_CSSStyleSelector::MatchDeclarations(
return matchedDecls;
}
-bool CFX_CSSStyleSelector::MatchSelector(const CFX_WideString& tagname,
+bool CFX_CSSStyleSelector::MatchSelector(const WideString& tagname,
CFX_CSSSelector* pSel) {
// TODO(dsinclair): The code only supports a single level of selector at this
// point. None of the code using selectors required the complexity so lets
@@ -80,8 +80,8 @@ bool CFX_CSSStyleSelector::MatchSelector(const CFX_WideString& tagname,
void CFX_CSSStyleSelector::ComputeStyle(
const std::vector<const CFX_CSSDeclaration*>& declArray,
- const CFX_WideString& styleString,
- const CFX_WideString& alignString,
+ const WideString& styleString,
+ const WideString& alignString,
CFX_CSSComputedStyle* pDest) {
std::unique_ptr<CFX_CSSDeclaration> pDecl;
if (!styleString.IsEmpty() || !alignString.IsEmpty()) {
@@ -91,7 +91,7 @@ void CFX_CSSStyleSelector::ComputeStyle(
AppendInlineStyle(pDecl.get(), styleString);
if (!alignString.IsEmpty()) {
pDecl->AddProperty(CFX_GetCSSPropertyByEnum(CFX_CSSProperty::TextAlign),
- alignString.AsStringC());
+ alignString.AsStringView());
}
}
ApplyDeclarations(declArray, pDecl.get(), pDest);
@@ -137,29 +137,29 @@ void CFX_CSSStyleSelector::ExtractValues(
}
void CFX_CSSStyleSelector::AppendInlineStyle(CFX_CSSDeclaration* pDecl,
- const CFX_WideString& style) {
+ const WideString& style) {
ASSERT(pDecl && !style.IsEmpty());
auto pSyntax = pdfium::MakeUnique<CFX_CSSSyntaxParser>(
style.c_str(), style.GetLength(), 32, true);
int32_t iLen2 = 0;
const CFX_CSSPropertyTable* table = nullptr;
- CFX_WideString wsName;
+ WideString wsName;
while (1) {
CFX_CSSSyntaxStatus eStatus = pSyntax->DoSyntaxParse();
if (eStatus == CFX_CSSSyntaxStatus::PropertyName) {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
table = CFX_GetCSSPropertyByName(strValue);
if (!table)
- wsName = CFX_WideString(strValue);
+ wsName = WideString(strValue);
} else if (eStatus == CFX_CSSSyntaxStatus::PropertyValue) {
if (table || iLen2 > 0) {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
if (!strValue.IsEmpty()) {
if (table)
pDecl->AddProperty(table, strValue);
else if (iLen2 > 0)
- pDecl->AddProperty(wsName, CFX_WideString(strValue));
+ pDecl->AddProperty(wsName, WideString(strValue));
}
}
} else {
diff --git a/core/fxcrt/css/cfx_cssstyleselector.h b/core/fxcrt/css/cfx_cssstyleselector.h
index 143e51ee68..b59e3048d6 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.h
+++ b/core/fxcrt/css/cfx_cssstyleselector.h
@@ -39,18 +39,17 @@ class CFX_CSSStyleSelector {
// adds non-inherited data from the parent style. Attempting to copy
// internally will fail as you'll lose the non-inherited data.
void ComputeStyle(const std::vector<const CFX_CSSDeclaration*>& declArray,
- const CFX_WideString& styleString,
- const CFX_WideString& alignString,
+ const WideString& styleString,
+ const WideString& alignString,
CFX_CSSComputedStyle* pDestStyle);
std::vector<const CFX_CSSDeclaration*> MatchDeclarations(
- const CFX_WideString& tagname);
+ const WideString& tagname);
private:
- bool MatchSelector(const CFX_WideString& tagname, CFX_CSSSelector* pSel);
+ bool MatchSelector(const WideString& tagname, CFX_CSSSelector* pSel);
- void AppendInlineStyle(CFX_CSSDeclaration* pDecl,
- const CFX_WideString& style);
+ void AppendInlineStyle(CFX_CSSDeclaration* pDecl, const WideString& style);
void ApplyDeclarations(
const std::vector<const CFX_CSSDeclaration*>& declArray,
const CFX_CSSDeclaration* extraDecl,
diff --git a/core/fxcrt/css/cfx_cssstylesheet.cpp b/core/fxcrt/css/cfx_cssstylesheet.cpp
index 9bd25c044f..183765f3b0 100644
--- a/core/fxcrt/css/cfx_cssstylesheet.cpp
+++ b/core/fxcrt/css/cfx_cssstylesheet.cpp
@@ -63,32 +63,32 @@ CFX_CSSSyntaxStatus CFX_CSSStyleSheet::LoadStyleRule(
CFX_CSSStyleRule* pStyleRule = nullptr;
int32_t iValueLen = 0;
const CFX_CSSPropertyTable* propertyTable = nullptr;
- CFX_WideString wsName;
+ WideString wsName;
while (1) {
switch (pSyntax->DoSyntaxParse()) {
case CFX_CSSSyntaxStatus::Selector: {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
auto pSelector = CFX_CSSSelector::FromString(strValue);
if (pSelector)
selectors.push_back(std::move(pSelector));
break;
}
case CFX_CSSSyntaxStatus::PropertyName: {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
propertyTable = CFX_GetCSSPropertyByName(strValue);
if (!propertyTable)
- wsName = CFX_WideString(strValue);
+ wsName = WideString(strValue);
break;
}
case CFX_CSSSyntaxStatus::PropertyValue: {
if (propertyTable || iValueLen > 0) {
- CFX_WideStringC strValue = pSyntax->GetCurrentString();
+ WideStringView strValue = pSyntax->GetCurrentString();
auto* decl = pStyleRule->GetDeclaration();
if (!strValue.IsEmpty()) {
if (propertyTable) {
decl->AddProperty(propertyTable, strValue);
} else {
- decl->AddProperty(wsName, CFX_WideString(strValue));
+ decl->AddProperty(wsName, WideString(strValue));
}
}
}
diff --git a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
index 4194a70490..abcd2f6972 100644
--- a/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
+++ b/core/fxcrt/css/cfx_cssstylesheet_unittest.cpp
@@ -28,7 +28,7 @@ class CFX_CSSStyleSheetTest : public testing::Test {
void TearDown() override { decl_ = nullptr; }
void LoadAndVerifyDecl(const wchar_t* buf,
- const std::vector<CFX_WideString>& selectors,
+ const std::vector<WideString>& selectors,
size_t decl_count) {
ASSERT(sheet_);
@@ -39,7 +39,7 @@ class CFX_CSSStyleSheetTest : public testing::Test {
EXPECT_EQ(selectors.size(), style->CountSelectorLists());
for (size_t i = 0; i < selectors.size(); i++) {
- uint32_t hash = FX_HashCode_GetW(selectors[i].AsStringC(), true);
+ uint32_t hash = FX_HashCode_GetW(selectors[i].AsStringView(), true);
EXPECT_EQ(hash, style->GetSelectorList(i)->GetNameHash());
}
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.cpp b/core/fxcrt/css/cfx_csssyntaxparser.cpp
index c8082e87fb..066b82b5d6 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.cpp
+++ b/core/fxcrt/css/cfx_csssyntaxparser.cpp
@@ -223,6 +223,6 @@ bool CFX_CSSSyntaxParser::RestoreMode() {
return true;
}
-CFX_WideStringC CFX_CSSSyntaxParser::GetCurrentString() const {
- return CFX_WideStringC(m_TextData.GetBuffer(), m_iTextDataLen);
+WideStringView CFX_CSSSyntaxParser::GetCurrentString() const {
+ return WideStringView(m_TextData.GetBuffer(), m_iTextDataLen);
}
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.h b/core/fxcrt/css/cfx_csssyntaxparser.h
index 9ddedfe4a7..778f9a3272 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.h
+++ b/core/fxcrt/css/cfx_csssyntaxparser.h
@@ -47,7 +47,7 @@ class CFX_CSSSyntaxParser {
~CFX_CSSSyntaxParser();
CFX_CSSSyntaxStatus DoSyntaxParse();
- CFX_WideStringC GetCurrentString() const;
+ WideStringView GetCurrentString() const;
protected:
void SwitchMode(CFX_CSSSyntaxMode eMode);
diff --git a/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp b/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp
index 510c96251d..62a542bc52 100644
--- a/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp
+++ b/core/fxcrt/css/cfx_cssvaluelistparser_unittest.cpp
@@ -18,25 +18,25 @@ TEST(CFX_CSSValueListParserTest, rgb_short) {
auto parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"#abc", 4, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::RGB, type);
- EXPECT_EQ(L"#abc", CFX_WideString(start, len));
+ EXPECT_EQ(L"#abc", WideString(start, len));
EXPECT_FALSE(parser->NextValue(type, start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"#abcdef", 7, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::RGB, type);
- EXPECT_EQ(L"#abcdef", CFX_WideString(start, len));
+ EXPECT_EQ(L"#abcdef", WideString(start, len));
EXPECT_FALSE(parser->NextValue(type, start, len));
parser =
pdfium::MakeUnique<CFX_CSSValueListParser>(L"rgb(1, 255, 4)", 14, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::RGB, type);
- EXPECT_EQ(L"rgb(1, 255, 4)", CFX_WideString(start, len));
+ EXPECT_EQ(L"rgb(1, 255, 4)", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"#abcdefghij", 11, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Unknown, type);
- EXPECT_EQ(L"#abcdefghij", CFX_WideString(start, len));
+ EXPECT_EQ(L"#abcdefghij", WideString(start, len));
EXPECT_FALSE(parser->NextValue(type, start, len));
}
@@ -48,38 +48,38 @@ TEST(CFX_CSSValueListParserTest, number_parsing) {
auto parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"1234", 4, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"1234", CFX_WideString(start, len));
+ EXPECT_EQ(L"1234", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"-1234", 5, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"-1234", CFX_WideString(start, len));
+ EXPECT_EQ(L"-1234", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"+1234", 5, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"+1234", CFX_WideString(start, len));
+ EXPECT_EQ(L"+1234", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L".1234", 5, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L".1234", CFX_WideString(start, len));
+ EXPECT_EQ(L".1234", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"4321.1234", 9, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"4321.1234", CFX_WideString(start, len));
+ EXPECT_EQ(L"4321.1234", WideString(start, len));
// TODO(dsinclair): These should probably fail but currently don't.
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"4321.12.34", 10, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"4321.12.34", CFX_WideString(start, len));
+ EXPECT_EQ(L"4321.12.34", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"43a1.12.34", 10, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"43a1.12.34", CFX_WideString(start, len));
+ EXPECT_EQ(L"43a1.12.34", WideString(start, len));
}
TEST(CFX_CSSValueListParserTest, string_parsing) {
@@ -91,18 +91,18 @@ TEST(CFX_CSSValueListParserTest, string_parsing) {
pdfium::MakeUnique<CFX_CSSValueListParser>(L"'string'", 8, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::String, type);
- EXPECT_EQ(L"string", CFX_WideString(start, len));
+ EXPECT_EQ(L"string", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"\"another string\"", 16,
L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::String, type);
- EXPECT_EQ(L"another string", CFX_WideString(start, len));
+ EXPECT_EQ(L"another string", WideString(start, len));
parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"standalone", 10, L' ');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::String, type);
- EXPECT_EQ(L"standalone", CFX_WideString(start, len));
+ EXPECT_EQ(L"standalone", WideString(start, len));
}
TEST(CFX_CSSValueListParserTest, multiparsing) {
@@ -113,15 +113,15 @@ TEST(CFX_CSSValueListParserTest, multiparsing) {
auto parser = pdfium::MakeUnique<CFX_CSSValueListParser>(L"1, 2, 3", 7, L',');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"1", CFX_WideString(start, len));
+ EXPECT_EQ(L"1", WideString(start, len));
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"2", CFX_WideString(start, len));
+ EXPECT_EQ(L"2", WideString(start, len));
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"3", CFX_WideString(start, len));
+ EXPECT_EQ(L"3", WideString(start, len));
EXPECT_FALSE(parser->NextValue(type, start, len));
@@ -129,13 +129,13 @@ TEST(CFX_CSSValueListParserTest, multiparsing) {
22, L',');
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::String, type);
- EXPECT_EQ(L"str", CFX_WideString(start, len));
+ EXPECT_EQ(L"str", WideString(start, len));
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::RGB, type);
- EXPECT_EQ(L"rgb(1, 2, 3)", CFX_WideString(start, len));
+ EXPECT_EQ(L"rgb(1, 2, 3)", WideString(start, len));
EXPECT_TRUE(parser->NextValue(type, start, len));
EXPECT_EQ(CFX_CSSPrimitiveType::Number, type);
- EXPECT_EQ(L"4", CFX_WideString(start, len));
+ EXPECT_EQ(L"4", WideString(start, len));
}
diff --git a/core/fxcrt/fx_bidi.cpp b/core/fxcrt/fx_bidi.cpp
index b7c7cacad8..cae0942550 100644
--- a/core/fxcrt/fx_bidi.cpp
+++ b/core/fxcrt/fx_bidi.cpp
@@ -581,7 +581,7 @@ void CFX_BidiChar::StartNewSegment(CFX_BidiChar::Direction direction) {
m_CurrentSegment.direction = direction;
}
-CFX_BidiString::CFX_BidiString(const CFX_WideString& str)
+CFX_BidiString::CFX_BidiString(const WideString& str)
: m_Str(str),
m_pBidiChar(pdfium::MakeUnique<CFX_BidiChar>()),
m_eOverallDirection(CFX_BidiChar::LEFT) {
diff --git a/core/fxcrt/fx_bidi.h b/core/fxcrt/fx_bidi.h
index 0dc426b57a..23f5d02dfd 100644
--- a/core/fxcrt/fx_bidi.h
+++ b/core/fxcrt/fx_bidi.h
@@ -54,7 +54,7 @@ class CFX_BidiString {
public:
using const_iterator = std::vector<CFX_BidiChar::Segment>::const_iterator;
- explicit CFX_BidiString(const CFX_WideString& str);
+ explicit CFX_BidiString(const WideString& str);
~CFX_BidiString();
// Overall direction is always LEFT or RIGHT, never NEUTRAL.
@@ -70,7 +70,7 @@ class CFX_BidiString {
const_iterator end() const { return m_Order.end(); }
private:
- const CFX_WideString m_Str;
+ const WideString m_Str;
std::unique_ptr<CFX_BidiChar> m_pBidiChar;
std::vector<CFX_BidiChar::Segment> m_Order;
CFX_BidiChar::Direction m_eOverallDirection;
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index 7f73a4ccad..4d0adb86ca 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -73,7 +73,7 @@ int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count) {
return wch1 - wch2;
}
-uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase) {
+uint32_t FX_HashCode_GetA(const ByteStringView& str, bool bIgnoreCase) {
uint32_t dwHashCode = 0;
if (bIgnoreCase) {
for (const auto& c : str)
@@ -85,7 +85,7 @@ uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase) {
return dwHashCode;
}
-uint32_t FX_HashCode_GetW(const CFX_WideStringC& str, bool bIgnoreCase) {
+uint32_t FX_HashCode_GetW(const WideStringView& str, bool bIgnoreCase) {
uint32_t dwHashCode = 0;
if (bIgnoreCase) {
for (const auto& c : str)
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index c269ec91ed..a04e781d0d 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -95,16 +95,16 @@ bool IFX_SeekableStream::WriteBlock(const void* buffer, size_t size) {
return WriteBlock(buffer, GetSize(), size);
}
-bool IFX_SeekableStream::WriteString(const CFX_ByteStringC& str) {
+bool IFX_SeekableStream::WriteString(const ByteStringView& str) {
return WriteBlock(str.unterminated_c_str(), str.GetLength());
}
FX_FileHandle* FX_OpenFolder(const char* path) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
auto pData = pdfium::MakeUnique<CFindFileDataA>();
- pData->m_Handle = FindFirstFileExA((CFX_ByteString(path) + "/*.*").c_str(),
- FindExInfoStandard, &pData->m_FindData,
- FindExSearchNameMatch, nullptr, 0);
+ pData->m_Handle =
+ FindFirstFileExA((ByteString(path) + "/*.*").c_str(), FindExInfoStandard,
+ &pData->m_FindData, FindExSearchNameMatch, nullptr, 0);
if (pData->m_Handle == INVALID_HANDLE_VALUE)
return nullptr;
@@ -116,7 +116,7 @@ FX_FileHandle* FX_OpenFolder(const char* path) {
}
bool FX_GetNextFile(FX_FileHandle* handle,
- CFX_ByteString* filename,
+ ByteString* filename,
bool* bFolder) {
if (!handle)
return false;
diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h
index abf031dade..08331e9bf0 100644
--- a/core/fxcrt/fx_stream.h
+++ b/core/fxcrt/fx_stream.h
@@ -29,9 +29,7 @@ typedef DIR FX_FileHandle;
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
FX_FileHandle* FX_OpenFolder(const char* path);
-bool FX_GetNextFile(FX_FileHandle* handle,
- CFX_ByteString* filename,
- bool* bFolder);
+bool FX_GetNextFile(FX_FileHandle* handle, ByteString* filename, bool* bFolder);
void FX_CloseFolder(FX_FileHandle* handle);
#define FX_FILEMODE_Write 0
@@ -41,7 +39,7 @@ void FX_CloseFolder(FX_FileHandle* handle);
class IFX_WriteStream : virtual public CFX_Retainable {
public:
virtual bool WriteBlock(const void* pData, size_t size) = 0;
- virtual bool WriteString(const CFX_ByteStringC& str) = 0;
+ virtual bool WriteString(const ByteStringView& str) = 0;
};
class IFX_ArchiveStream : public IFX_WriteStream {
@@ -107,7 +105,7 @@ class IFX_SeekableStream : public IFX_SeekableReadStream,
FX_FILESIZE offset,
size_t size) override = 0;
bool WriteBlock(const void* buffer, size_t size) override;
- bool WriteString(const CFX_ByteStringC& str) override;
+ bool WriteString(const ByteStringView& str) override;
bool Flush() override = 0;
};
diff --git a/core/fxcrt/fx_string.cpp b/core/fxcrt/fx_string.cpp
index 075f29e538..ce4e187837 100644
--- a/core/fxcrt/fx_string.cpp
+++ b/core/fxcrt/fx_string.cpp
@@ -51,8 +51,8 @@ class CFX_UTF8Encoder {
// The data returned by GetResult() is invalidated when this is modified by
// appending any data.
- CFX_ByteStringC GetResult() const {
- return CFX_ByteStringC(m_Buffer.data(), m_Buffer.size());
+ ByteStringView GetResult() const {
+ return ByteStringView(m_Buffer.data(), m_Buffer.size());
}
private:
@@ -61,14 +61,14 @@ class CFX_UTF8Encoder {
} // namespace
-CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr) {
+ByteString FX_UTF8Encode(const WideStringView& wsStr) {
FX_STRSIZE len = wsStr.GetLength();
const wchar_t* pStr = wsStr.unterminated_c_str();
CFX_UTF8Encoder encoder;
while (len-- > 0)
encoder.Input(*pStr++);
- return CFX_ByteString(encoder.GetResult());
+ return ByteString(encoder.GetResult());
}
namespace {
@@ -84,7 +84,7 @@ float FractionalScale(size_t scale_factor, int value) {
} // namespace
-bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
+bool FX_atonum(const ByteStringView& strc, void* pData) {
if (strc.Contains('.')) {
float* pFloat = static_cast<float*>(pData);
*pFloat = FX_atof(strc);
@@ -141,7 +141,7 @@ bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
return true;
}
-float FX_atof(const CFX_ByteStringC& strc) {
+float FX_atof(const ByteStringView& strc) {
if (strc.IsEmpty())
return 0.0;
@@ -180,7 +180,7 @@ float FX_atof(const CFX_ByteStringC& strc) {
return bNegative ? -value : value;
}
-float FX_atof(const CFX_WideStringC& wsStr) {
+float FX_atof(const WideStringView& wsStr) {
return FX_atof(FX_UTF8Encode(wsStr).c_str());
}
diff --git a/core/fxcrt/fx_string.h b/core/fxcrt/fx_string.h
index 9cc0b251eb..0481a15d34 100644
--- a/core/fxcrt/fx_string.h
+++ b/core/fxcrt/fx_string.h
@@ -7,17 +7,17 @@
#ifndef CORE_FXCRT_FX_STRING_H_
#define CORE_FXCRT_FX_STRING_H_
-#include "core/fxcrt/cfx_bytestring.h"
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/bytestring.h"
+#include "core/fxcrt/widestring.h"
#define FXBSTR_ID(c1, c2, c3, c4) \
(((uint32_t)c1 << 24) | ((uint32_t)c2 << 16) | ((uint32_t)c3 << 8) | \
((uint32_t)c4))
-CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr);
-float FX_atof(const CFX_ByteStringC& str);
-float FX_atof(const CFX_WideStringC& wsStr);
-bool FX_atonum(const CFX_ByteStringC& str, void* pData);
+ByteString FX_UTF8Encode(const WideStringView& wsStr);
+float FX_atof(const ByteStringView& str);
+float FX_atof(const WideStringView& wsStr);
+bool FX_atonum(const ByteStringView& str, void* pData);
FX_STRSIZE FX_ftoa(float f, char* buf);
#endif // CORE_FXCRT_FX_STRING_H_
diff --git a/core/fxcrt/ifx_fileaccess.h b/core/fxcrt/ifx_fileaccess.h
index e818303d85..9bfe2b4e63 100644
--- a/core/fxcrt/ifx_fileaccess.h
+++ b/core/fxcrt/ifx_fileaccess.h
@@ -19,8 +19,8 @@ class IFX_FileAccess {
static std::unique_ptr<IFX_FileAccess> Create();
virtual ~IFX_FileAccess() {}
- virtual bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) = 0;
- virtual bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) = 0;
+ virtual bool Open(const ByteStringView& fileName, uint32_t dwMode) = 0;
+ virtual bool Open(const WideStringView& fileName, uint32_t dwMode) = 0;
virtual void Close() = 0;
virtual FX_FILESIZE GetSize() const = 0;
virtual FX_FILESIZE GetPosition() const = 0;
diff --git a/core/fxcrt/ifx_locale.h b/core/fxcrt/ifx_locale.h
index 5039aec6f0..5918e7a183 100644
--- a/core/fxcrt/ifx_locale.h
+++ b/core/fxcrt/ifx_locale.h
@@ -58,19 +58,19 @@ class IFX_Locale {
public:
virtual ~IFX_Locale() {}
- virtual CFX_WideString GetName() const = 0;
- virtual CFX_WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const = 0;
- virtual CFX_WideString GetDateTimeSymbols() const = 0;
- virtual CFX_WideString GetMonthName(int32_t nMonth, bool bAbbr) const = 0;
- virtual CFX_WideString GetDayName(int32_t nWeek, bool bAbbr) const = 0;
- virtual CFX_WideString GetMeridiemName(bool bAM) const = 0;
+ virtual WideString GetName() const = 0;
+ virtual WideString GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const = 0;
+ virtual WideString GetDateTimeSymbols() const = 0;
+ virtual WideString GetMonthName(int32_t nMonth, bool bAbbr) const = 0;
+ virtual WideString GetDayName(int32_t nWeek, bool bAbbr) const = 0;
+ virtual WideString GetMeridiemName(bool bAM) const = 0;
virtual FX_TIMEZONE GetTimeZone() const = 0;
- virtual CFX_WideString GetEraName(bool bAD) const = 0;
- virtual CFX_WideString GetDatePattern(
+ virtual WideString GetEraName(bool bAD) const = 0;
+ virtual WideString GetDatePattern(
FX_LOCALEDATETIMESUBCATEGORY eType) const = 0;
- virtual CFX_WideString GetTimePattern(
+ virtual WideString GetTimePattern(
FX_LOCALEDATETIMESUBCATEGORY eType) const = 0;
- virtual CFX_WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const = 0;
+ virtual WideString GetNumPattern(FX_LOCALENUMSUBCATEGORY eType) const = 0;
};
#endif // CORE_FXCRT_IFX_LOCALE_H_
diff --git a/core/fxcrt/cfx_string_c_template.h b/core/fxcrt/string_view_template.h
index 9123fc234b..21426acaeb 100644
--- a/core/fxcrt/cfx_string_c_template.h
+++ b/core/fxcrt/string_view_template.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FXCRT_CFX_STRING_C_TEMPLATE_H_
-#define CORE_FXCRT_CFX_STRING_C_TEMPLATE_H_
+#ifndef CORE_FXCRT_STRING_VIEW_TEMPLATE_H_
+#define CORE_FXCRT_STRING_VIEW_TEMPLATE_H_
#include <algorithm>
#include <iterator>
@@ -18,61 +18,63 @@
#include "third_party/base/optional.h"
#include "third_party/base/stl_util.h"
+namespace fxcrt {
+
// An immutable string with caller-provided storage which must outlive the
// string itself. These are not necessarily nul-terminated, so that substring
// extraction (via the Mid(), Left(), and Right() methods) is copy-free.
template <typename T>
-class CFX_StringCTemplate {
+class StringViewTemplate {
public:
using CharType = T;
using UnsignedType = typename std::make_unsigned<CharType>::type;
using const_iterator = const CharType*;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
- CFX_StringCTemplate() : m_Ptr(nullptr), m_Length(0) {}
+ StringViewTemplate() : m_Ptr(nullptr), m_Length(0) {}
// Deliberately implicit to avoid calling on every string literal.
// NOLINTNEXTLINE(runtime/explicit)
- CFX_StringCTemplate(const CharType* ptr)
+ StringViewTemplate(const CharType* ptr)
: m_Ptr(reinterpret_cast<const UnsignedType*>(ptr)),
m_Length(ptr ? FXSYS_len(ptr) : 0) {}
- CFX_StringCTemplate(const CharType* ptr, FX_STRSIZE len)
+ StringViewTemplate(const CharType* ptr, FX_STRSIZE len)
: m_Ptr(reinterpret_cast<const UnsignedType*>(ptr)), m_Length(len) {}
template <typename U = UnsignedType>
- CFX_StringCTemplate(
+ StringViewTemplate(
const UnsignedType* ptr,
FX_STRSIZE size,
typename std::enable_if<!std::is_same<U, CharType>::value>::type* = 0)
: m_Ptr(ptr), m_Length(size) {}
// Deliberately implicit to avoid calling on every string literal.
- // |ch| must be an lvalue that outlives the the CFX_StringCTemplate.
+ // |ch| must be an lvalue that outlives the the StringViewTemplate.
// NOLINTNEXTLINE(runtime/explicit)
- CFX_StringCTemplate(CharType& ch) {
+ StringViewTemplate(CharType& ch) {
m_Ptr = reinterpret_cast<const UnsignedType*>(&ch);
m_Length = 1;
}
- CFX_StringCTemplate(const CFX_StringCTemplate& src) {
+ StringViewTemplate(const StringViewTemplate& src) {
m_Ptr = src.m_Ptr;
m_Length = src.m_Length;
}
// Any changes to |vec| invalidate the string.
- explicit CFX_StringCTemplate(const std::vector<UnsignedType>& vec) {
+ explicit StringViewTemplate(const std::vector<UnsignedType>& vec) {
m_Length = pdfium::CollectionSize<FX_STRSIZE>(vec);
m_Ptr = m_Length ? vec.data() : nullptr;
}
- CFX_StringCTemplate& operator=(const CharType* src) {
+ StringViewTemplate& operator=(const CharType* src) {
m_Ptr = reinterpret_cast<const UnsignedType*>(src);
m_Length = src ? FXSYS_len(src) : 0;
return *this;
}
- CFX_StringCTemplate& operator=(const CFX_StringCTemplate& src) {
+ StringViewTemplate& operator=(const StringViewTemplate& src) {
m_Ptr = src.m_Ptr;
m_Length = src.m_Length;
return *this;
@@ -98,14 +100,14 @@ class CFX_StringCTemplate {
FXSYS_cmp(ptr, reinterpret_cast<const CharType*>(m_Ptr.Get()),
m_Length) == 0;
}
- bool operator==(const CFX_StringCTemplate& other) const {
+ bool operator==(const StringViewTemplate& other) const {
return other.m_Length == m_Length &&
FXSYS_cmp(reinterpret_cast<const CharType*>(other.m_Ptr.Get()),
reinterpret_cast<const CharType*>(m_Ptr.Get()),
m_Length) == 0;
}
bool operator!=(const CharType* ptr) const { return !(*this == ptr); }
- bool operator!=(const CFX_StringCTemplate& other) const {
+ bool operator!=(const StringViewTemplate& other) const {
return !(*this == other);
}
@@ -157,56 +159,56 @@ class CFX_StringCTemplate {
bool Contains(CharType ch) const { return Find(ch).has_value(); }
- CFX_StringCTemplate Mid(FX_STRSIZE first, FX_STRSIZE count) const {
+ StringViewTemplate Mid(FX_STRSIZE first, FX_STRSIZE count) const {
if (!m_Ptr.Get())
- return CFX_StringCTemplate();
+ return StringViewTemplate();
if (!IsValidIndex(first))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
if (count == 0 || !IsValidLength(count))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
if (!IsValidIndex(first + count - 1))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
- return CFX_StringCTemplate(m_Ptr.Get() + first, count);
+ return StringViewTemplate(m_Ptr.Get() + first, count);
}
- CFX_StringCTemplate Left(FX_STRSIZE count) const {
+ StringViewTemplate Left(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
return Mid(0, count);
}
- CFX_StringCTemplate Right(FX_STRSIZE count) const {
+ StringViewTemplate Right(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_StringCTemplate();
+ return StringViewTemplate();
return Mid(GetLength() - count, count);
}
- CFX_StringCTemplate TrimmedRight(CharType ch) const {
+ StringViewTemplate TrimmedRight(CharType ch) const {
if (IsEmpty())
- return CFX_StringCTemplate();
+ return StringViewTemplate();
FX_STRSIZE pos = GetLength();
while (pos && CharAt(pos - 1) == ch)
pos--;
if (pos == 0)
- return CFX_StringCTemplate();
+ return StringViewTemplate();
- return CFX_StringCTemplate(m_Ptr.Get(), pos);
+ return StringViewTemplate(m_Ptr.Get(), pos);
}
- bool operator<(const CFX_StringCTemplate& that) const {
+ bool operator<(const StringViewTemplate& that) const {
int result = FXSYS_cmp(reinterpret_cast<const CharType*>(m_Ptr.Get()),
reinterpret_cast<const CharType*>(that.m_Ptr.Get()),
std::min(m_Length, that.m_Length));
return result < 0 || (result == 0 && m_Length < that.m_Length);
}
- bool operator>(const CFX_StringCTemplate& that) const {
+ bool operator>(const StringViewTemplate& that) const {
int result = FXSYS_cmp(reinterpret_cast<const CharType*>(m_Ptr.Get()),
reinterpret_cast<const CharType*>(that.m_Ptr.Get()),
std::min(m_Length, that.m_Length));
@@ -222,19 +224,24 @@ class CFX_StringCTemplate {
};
template <typename T>
-inline bool operator==(const T* lhs, const CFX_StringCTemplate<T>& rhs) {
+inline bool operator==(const T* lhs, const StringViewTemplate<T>& rhs) {
return rhs == lhs;
}
template <typename T>
-inline bool operator!=(const T* lhs, const CFX_StringCTemplate<T>& rhs) {
+inline bool operator!=(const T* lhs, const StringViewTemplate<T>& rhs) {
return rhs != lhs;
}
-extern template class CFX_StringCTemplate<char>;
-extern template class CFX_StringCTemplate<wchar_t>;
+extern template class StringViewTemplate<char>;
+extern template class StringViewTemplate<wchar_t>;
+
+using ByteStringView = StringViewTemplate<char>;
+using WideStringView = StringViewTemplate<wchar_t>;
+
+} // namespace fxcrt
-using CFX_ByteStringC = CFX_StringCTemplate<char>;
-using CFX_WideStringC = CFX_StringCTemplate<wchar_t>;
+using ByteStringView = fxcrt::ByteStringView;
+using WideStringView = fxcrt::WideStringView;
-#endif // CORE_FXCRT_CFX_STRING_C_TEMPLATE_H_
+#endif // CORE_FXCRT_STRING_VIEW_TEMPLATE_H_
diff --git a/core/fxcrt/cfx_widestring.cpp b/core/fxcrt/widestring.cpp
index aadd1a29ed..fa5c80130d 100644
--- a/core/fxcrt/cfx_widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/widestring.h"
#include <stddef.h>
@@ -21,9 +21,9 @@
#include "third_party/base/stl_util.h"
template class CFX_StringDataTemplate<wchar_t>;
-template class CFX_StringCTemplate<wchar_t>;
-template class CFX_StringPoolTemplate<CFX_WideString>;
-template struct std::hash<CFX_WideString>;
+template class fxcrt::StringViewTemplate<wchar_t>;
+template class CFX_StringPoolTemplate<WideString>;
+template struct std::hash<WideString>;
#define FORCE_ANSI 0x10000
#define FORCE_UNICODE 0x20000
@@ -261,16 +261,16 @@ bool IsValidCodePage(uint16_t codepage) {
}
#endif
-CFX_WideString GetWideString(uint16_t codepage, const CFX_ByteStringC& bstr) {
+WideString GetWideString(uint16_t codepage, const ByteStringView& bstr) {
ASSERT(IsValidCodePage(codepage));
int src_len = bstr.GetLength();
int dest_len = FXSYS_MultiByteToWideChar(
codepage, 0, bstr.unterminated_c_str(), src_len, nullptr, 0);
if (!dest_len)
- return CFX_WideString();
+ return WideString();
- CFX_WideString wstr;
+ WideString wstr;
wchar_t* dest_buf = wstr.GetBuffer(dest_len);
FXSYS_MultiByteToWideChar(codepage, 0, bstr.unterminated_c_str(), src_len,
dest_buf, dest_len);
@@ -280,40 +280,40 @@ CFX_WideString GetWideString(uint16_t codepage, const CFX_ByteStringC& bstr) {
} // namespace
-static_assert(sizeof(CFX_WideString) <= sizeof(wchar_t*),
+namespace fxcrt {
+
+static_assert(sizeof(WideString) <= sizeof(wchar_t*),
"Strings must not require more space than pointers");
-CFX_WideString::CFX_WideString() {}
+WideString::WideString() {}
-CFX_WideString::CFX_WideString(const CFX_WideString& other)
- : m_pData(other.m_pData) {}
+WideString::WideString(const WideString& other) : m_pData(other.m_pData) {}
-CFX_WideString::CFX_WideString(CFX_WideString&& other) noexcept {
+WideString::WideString(WideString&& other) noexcept {
m_pData.Swap(other.m_pData);
}
-CFX_WideString::CFX_WideString(const wchar_t* pStr, FX_STRSIZE nLen) {
+WideString::WideString(const wchar_t* pStr, FX_STRSIZE nLen) {
if (nLen)
m_pData.Reset(StringData::Create(pStr, nLen));
}
-CFX_WideString::CFX_WideString(wchar_t ch) {
+WideString::WideString(wchar_t ch) {
m_pData.Reset(StringData::Create(1));
m_pData->m_String[0] = ch;
}
-CFX_WideString::CFX_WideString(const wchar_t* ptr)
- : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {}
+WideString::WideString(const wchar_t* ptr)
+ : WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {}
-CFX_WideString::CFX_WideString(const CFX_WideStringC& stringSrc) {
+WideString::WideString(const WideStringView& stringSrc) {
if (!stringSrc.IsEmpty()) {
m_pData.Reset(StringData::Create(stringSrc.unterminated_c_str(),
stringSrc.GetLength()));
}
}
-CFX_WideString::CFX_WideString(const CFX_WideStringC& str1,
- const CFX_WideStringC& str2) {
+WideString::WideString(const WideStringView& str1, const WideStringView& str2) {
FX_SAFE_STRSIZE nSafeLen = str1.GetLength();
nSafeLen += str2.GetLength();
@@ -327,8 +327,7 @@ CFX_WideString::CFX_WideString(const CFX_WideStringC& str1,
str2.GetLength());
}
-CFX_WideString::CFX_WideString(
- const std::initializer_list<CFX_WideStringC>& list) {
+WideString::WideString(const std::initializer_list<WideStringView>& list) {
FX_SAFE_STRSIZE nSafeLen = 0;
for (const auto& item : list)
nSafeLen += item.GetLength();
@@ -347,9 +346,9 @@ CFX_WideString::CFX_WideString(
}
}
-CFX_WideString::~CFX_WideString() {}
+WideString::~WideString() {}
-const CFX_WideString& CFX_WideString::operator=(const wchar_t* pStr) {
+const WideString& WideString::operator=(const wchar_t* pStr) {
if (!pStr || !pStr[0])
clear();
else
@@ -358,8 +357,7 @@ const CFX_WideString& CFX_WideString::operator=(const wchar_t* pStr) {
return *this;
}
-const CFX_WideString& CFX_WideString::operator=(
- const CFX_WideStringC& stringSrc) {
+const WideString& WideString::operator=(const WideStringView& stringSrc) {
if (stringSrc.IsEmpty())
clear();
else
@@ -368,41 +366,40 @@ const CFX_WideString& CFX_WideString::operator=(
return *this;
}
-const CFX_WideString& CFX_WideString::operator=(
- const CFX_WideString& stringSrc) {
+const WideString& WideString::operator=(const WideString& stringSrc) {
if (m_pData != stringSrc.m_pData)
m_pData = stringSrc.m_pData;
return *this;
}
-const CFX_WideString& CFX_WideString::operator+=(const wchar_t* pStr) {
+const WideString& WideString::operator+=(const wchar_t* pStr) {
if (pStr)
Concat(pStr, FXSYS_wcslen(pStr));
return *this;
}
-const CFX_WideString& CFX_WideString::operator+=(wchar_t ch) {
+const WideString& WideString::operator+=(wchar_t ch) {
Concat(&ch, 1);
return *this;
}
-const CFX_WideString& CFX_WideString::operator+=(const CFX_WideString& str) {
+const WideString& WideString::operator+=(const WideString& str) {
if (str.m_pData)
Concat(str.m_pData->m_String, str.m_pData->m_nDataLength);
return *this;
}
-const CFX_WideString& CFX_WideString::operator+=(const CFX_WideStringC& str) {
+const WideString& WideString::operator+=(const WideStringView& str) {
if (!str.IsEmpty())
Concat(str.unterminated_c_str(), str.GetLength());
return *this;
}
-bool CFX_WideString::operator==(const wchar_t* ptr) const {
+bool WideString::operator==(const wchar_t* ptr) const {
if (!m_pData)
return !ptr || !ptr[0];
@@ -413,7 +410,7 @@ bool CFX_WideString::operator==(const wchar_t* ptr) const {
wmemcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
}
-bool CFX_WideString::operator==(const CFX_WideStringC& str) const {
+bool WideString::operator==(const WideStringView& str) const {
if (!m_pData)
return str.IsEmpty();
@@ -422,7 +419,7 @@ bool CFX_WideString::operator==(const CFX_WideStringC& str) const {
str.GetLength()) == 0;
}
-bool CFX_WideString::operator==(const CFX_WideString& other) const {
+bool WideString::operator==(const WideString& other) const {
if (m_pData == other.m_pData)
return true;
@@ -437,7 +434,7 @@ bool CFX_WideString::operator==(const CFX_WideString& other) const {
m_pData->m_nDataLength) == 0;
}
-bool CFX_WideString::operator<(const CFX_WideString& str) const {
+bool WideString::operator<(const WideString& str) const {
if (m_pData == str.m_pData)
return false;
@@ -446,13 +443,13 @@ bool CFX_WideString::operator<(const CFX_WideString& str) const {
return result < 0 || (result == 0 && GetLength() < str.GetLength());
}
-void CFX_WideString::AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
+void WideString::AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
AllocBeforeWrite(nSrcLen);
m_pData->CopyContents(pSrcData, nSrcLen);
m_pData->m_nDataLength = nSrcLen;
}
-void CFX_WideString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
+void WideString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
if (m_pData && m_pData->CanOperateInPlace(nNewLength))
return;
@@ -473,7 +470,7 @@ void CFX_WideString::ReallocBeforeWrite(FX_STRSIZE nNewLength) {
m_pData.Swap(pNewData);
}
-void CFX_WideString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
+void WideString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
if (m_pData && m_pData->CanOperateInPlace(nNewLength))
return;
@@ -485,7 +482,7 @@ void CFX_WideString::AllocBeforeWrite(FX_STRSIZE nNewLength) {
m_pData.Reset(StringData::Create(nNewLength));
}
-void CFX_WideString::ReleaseBuffer(FX_STRSIZE nNewLength) {
+void WideString::ReleaseBuffer(FX_STRSIZE nNewLength) {
if (!m_pData)
return;
@@ -501,16 +498,16 @@ void CFX_WideString::ReleaseBuffer(FX_STRSIZE nNewLength) {
if (m_pData->m_nAllocLength - nNewLength >= 32) {
// Over arbitrary threshold, so pay the price to relocate. Force copy to
// always occur by holding a second reference to the string.
- CFX_WideString preserve(*this);
+ WideString preserve(*this);
ReallocBeforeWrite(nNewLength);
}
}
-void CFX_WideString::Reserve(FX_STRSIZE len) {
+void WideString::Reserve(FX_STRSIZE len) {
GetBuffer(len);
}
-wchar_t* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) {
+wchar_t* WideString::GetBuffer(FX_STRSIZE nMinBufLength) {
if (!m_pData) {
if (nMinBufLength == 0)
return nullptr;
@@ -535,7 +532,7 @@ wchar_t* CFX_WideString::GetBuffer(FX_STRSIZE nMinBufLength) {
return m_pData->m_String;
}
-FX_STRSIZE CFX_WideString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
+FX_STRSIZE WideString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
if (!m_pData)
return 0;
@@ -556,7 +553,7 @@ FX_STRSIZE CFX_WideString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
return m_pData->m_nDataLength;
}
-void CFX_WideString::Concat(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
+void WideString::Concat(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
if (!pSrcData || nSrcLen == 0)
return;
@@ -578,16 +575,16 @@ void CFX_WideString::Concat(const wchar_t* pSrcData, FX_STRSIZE nSrcLen) {
m_pData.Swap(pNewData);
}
-CFX_ByteString CFX_WideString::UTF8Encode() const {
- return FX_UTF8Encode(AsStringC());
+ByteString WideString::UTF8Encode() const {
+ return FX_UTF8Encode(AsStringView());
}
-CFX_ByteString CFX_WideString::UTF16LE_Encode() const {
+ByteString WideString::UTF16LE_Encode() const {
if (!m_pData) {
- return CFX_ByteString("\0\0", 2);
+ return ByteString("\0\0", 2);
}
int len = m_pData->m_nDataLength;
- CFX_ByteString result;
+ ByteString result;
char* buffer = result.GetBuffer(len * 2 + 2);
for (int i = 0; i < len; i++) {
buffer[i * 2] = m_pData->m_String[i] & 0xff;
@@ -599,42 +596,42 @@ CFX_ByteString CFX_WideString::UTF16LE_Encode() const {
return result;
}
-CFX_WideString CFX_WideString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
+WideString WideString::Mid(FX_STRSIZE first, FX_STRSIZE count) const {
if (!m_pData)
- return CFX_WideString();
+ return WideString();
if (!IsValidIndex(first))
- return CFX_WideString();
+ return WideString();
if (count == 0 || !IsValidLength(count))
- return CFX_WideString();
+ return WideString();
if (!IsValidIndex(first + count - 1))
- return CFX_WideString();
+ return WideString();
if (first == 0 && count == GetLength())
return *this;
- CFX_WideString dest;
+ WideString dest;
AllocCopy(dest, count, first);
return dest;
}
-CFX_WideString CFX_WideString::Left(FX_STRSIZE count) const {
+WideString WideString::Left(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_WideString();
+ return WideString();
return Mid(0, count);
}
-CFX_WideString CFX_WideString::Right(FX_STRSIZE count) const {
+WideString WideString::Right(FX_STRSIZE count) const {
if (count == 0 || !IsValidLength(count))
- return CFX_WideString();
+ return WideString();
return Mid(GetLength() - count, count);
}
-void CFX_WideString::AllocCopy(CFX_WideString& dest,
- FX_STRSIZE nCopyLen,
- FX_STRSIZE nCopyIndex) const {
+void WideString::AllocCopy(WideString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const {
if (nCopyLen == 0)
return;
@@ -643,9 +640,9 @@ void CFX_WideString::AllocCopy(CFX_WideString& dest,
dest.m_pData.Swap(pNewData);
}
-bool CFX_WideString::TryVSWPrintf(FX_STRSIZE size,
- const wchar_t* pFormat,
- va_list argList) {
+bool WideString::TryVSWPrintf(FX_STRSIZE size,
+ const wchar_t* pFormat,
+ va_list argList) {
GetBuffer(size);
if (!m_pData)
return true;
@@ -663,7 +660,7 @@ bool CFX_WideString::TryVSWPrintf(FX_STRSIZE size,
return bSufficientBuffer;
}
-void CFX_WideString::FormatV(const wchar_t* format, va_list argList) {
+void WideString::FormatV(const wchar_t* format, va_list argList) {
va_list argListCopy;
va_copy(argListCopy, argList);
int maxLen = vswprintf(nullptr, 0, format, argListCopy);
@@ -687,14 +684,14 @@ void CFX_WideString::FormatV(const wchar_t* format, va_list argList) {
}
}
-void CFX_WideString::Format(const wchar_t* pFormat, ...) {
+void WideString::Format(const wchar_t* pFormat, ...) {
va_list argList;
va_start(argList, pFormat);
FormatV(pFormat, argList);
va_end(argList);
}
-FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE location, wchar_t ch) {
+FX_STRSIZE WideString::Insert(FX_STRSIZE location, wchar_t ch) {
const FX_STRSIZE cur_length = m_pData ? m_pData->m_nDataLength : 0;
if (!IsValidLength(location))
return cur_length;
@@ -708,8 +705,8 @@ FX_STRSIZE CFX_WideString::Insert(FX_STRSIZE location, wchar_t ch) {
return new_length;
}
-pdfium::Optional<FX_STRSIZE> CFX_WideString::Find(wchar_t ch,
- FX_STRSIZE start) const {
+pdfium::Optional<FX_STRSIZE> WideString::Find(wchar_t ch,
+ FX_STRSIZE start) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -723,8 +720,8 @@ pdfium::Optional<FX_STRSIZE> CFX_WideString::Find(wchar_t ch,
: pdfium::Optional<FX_STRSIZE>();
}
-pdfium::Optional<FX_STRSIZE> CFX_WideString::Find(const CFX_WideStringC& subStr,
- FX_STRSIZE start) const {
+pdfium::Optional<FX_STRSIZE> WideString::Find(const WideStringView& subStr,
+ FX_STRSIZE start) const {
if (!m_pData)
return pdfium::Optional<FX_STRSIZE>();
@@ -739,7 +736,7 @@ pdfium::Optional<FX_STRSIZE> CFX_WideString::Find(const CFX_WideStringC& subStr,
: pdfium::Optional<FX_STRSIZE>();
}
-void CFX_WideString::MakeLower() {
+void WideString::MakeLower() {
if (!m_pData)
return;
@@ -747,7 +744,7 @@ void CFX_WideString::MakeLower() {
FXSYS_wcslwr(m_pData->m_String);
}
-void CFX_WideString::MakeUpper() {
+void WideString::MakeUpper() {
if (!m_pData)
return;
@@ -755,7 +752,7 @@ void CFX_WideString::MakeUpper() {
FXSYS_wcsupr(m_pData->m_String);
}
-FX_STRSIZE CFX_WideString::Remove(wchar_t chRemove) {
+FX_STRSIZE WideString::Remove(wchar_t chRemove) {
if (!m_pData || m_pData->m_nDataLength < 1)
return 0;
@@ -789,8 +786,8 @@ FX_STRSIZE CFX_WideString::Remove(wchar_t chRemove) {
return count;
}
-FX_STRSIZE CFX_WideString::Replace(const CFX_WideStringC& pOld,
- const CFX_WideStringC& pNew) {
+FX_STRSIZE WideString::Replace(const WideStringView& pOld,
+ const WideStringView& pNew) {
if (!m_pData || pOld.IsEmpty())
return 0;
@@ -837,36 +834,36 @@ FX_STRSIZE CFX_WideString::Replace(const CFX_WideStringC& pOld,
}
// static
-CFX_WideString CFX_WideString::FromLocal(const CFX_ByteStringC& str) {
+WideString WideString::FromLocal(const ByteStringView& str) {
return FromCodePage(str, 0);
}
// static
-CFX_WideString CFX_WideString::FromCodePage(const CFX_ByteStringC& str,
- uint16_t codepage) {
+WideString WideString::FromCodePage(const ByteStringView& str,
+ uint16_t codepage) {
return GetWideString(codepage, str);
}
// static
-CFX_WideString CFX_WideString::FromUTF8(const CFX_ByteStringC& str) {
+WideString WideString::FromUTF8(const ByteStringView& str) {
if (str.IsEmpty())
- return CFX_WideString();
+ return WideString();
CFX_UTF8Decoder decoder;
for (FX_STRSIZE i = 0; i < str.GetLength(); i++)
decoder.Input(str[i]);
- return CFX_WideString(decoder.GetResult());
+ return WideString(decoder.GetResult());
}
// static
-CFX_WideString CFX_WideString::FromUTF16LE(const unsigned short* wstr,
- FX_STRSIZE wlen) {
+WideString WideString::FromUTF16LE(const unsigned short* wstr,
+ FX_STRSIZE wlen) {
if (!wstr || wlen == 0) {
- return CFX_WideString();
+ return WideString();
}
- CFX_WideString result;
+ WideString result;
wchar_t* buf = result.GetBuffer(wlen);
for (FX_STRSIZE i = 0; i < wlen; i++) {
buf[i] = wstr[i];
@@ -875,19 +872,19 @@ CFX_WideString CFX_WideString::FromUTF16LE(const unsigned short* wstr,
return result;
}
-void CFX_WideString::SetAt(FX_STRSIZE index, wchar_t c) {
+void WideString::SetAt(FX_STRSIZE index, wchar_t c) {
ASSERT(IsValidIndex(index));
ReallocBeforeWrite(m_pData->m_nDataLength);
m_pData->m_String[index] = c;
}
-int CFX_WideString::Compare(const wchar_t* lpsz) const {
+int WideString::Compare(const wchar_t* lpsz) const {
if (m_pData)
return wcscmp(m_pData->m_String, lpsz);
return (!lpsz || lpsz[0] == 0) ? 0 : -1;
}
-int CFX_WideString::Compare(const CFX_WideString& str) const {
+int WideString::Compare(const WideString& str) const {
if (!m_pData) {
if (!str.m_pData) {
return 0;
@@ -917,14 +914,14 @@ int CFX_WideString::Compare(const CFX_WideString& str) const {
return 0;
}
-int CFX_WideString::CompareNoCase(const wchar_t* lpsz) const {
+int WideString::CompareNoCase(const wchar_t* lpsz) const {
if (!m_pData) {
return (!lpsz || lpsz[0] == 0) ? 0 : -1;
}
return FXSYS_wcsicmp(m_pData->m_String, lpsz);
}
-FX_STRSIZE CFX_WideString::WStringLength(const unsigned short* str) {
+FX_STRSIZE WideString::WStringLength(const unsigned short* str) {
FX_STRSIZE len = 0;
if (str)
while (str[len])
@@ -932,7 +929,7 @@ FX_STRSIZE CFX_WideString::WStringLength(const unsigned short* str) {
return len;
}
-void CFX_WideString::TrimRight(const CFX_WideStringC& pTargets) {
+void WideString::TrimRight(const WideStringView& pTargets) {
if (IsEmpty() || pTargets.IsEmpty())
return;
@@ -947,16 +944,16 @@ void CFX_WideString::TrimRight(const CFX_WideStringC& pTargets) {
}
}
-void CFX_WideString::TrimRight(wchar_t chTarget) {
+void WideString::TrimRight(wchar_t chTarget) {
wchar_t str[2] = {chTarget, 0};
TrimRight(str);
}
-void CFX_WideString::TrimRight() {
+void WideString::TrimRight() {
TrimRight(L"\x09\x0a\x0b\x0c\x0d\x20");
}
-void CFX_WideString::TrimLeft(const CFX_WideStringC& pTargets) {
+void WideString::TrimLeft(const WideStringView& pTargets) {
if (!m_pData || pTargets.IsEmpty())
return;
@@ -986,12 +983,12 @@ void CFX_WideString::TrimLeft(const CFX_WideStringC& pTargets) {
m_pData->m_nDataLength = nDataLength;
}
-void CFX_WideString::TrimLeft(wchar_t chTarget) {
+void WideString::TrimLeft(wchar_t chTarget) {
wchar_t str[2] = {chTarget, 0};
TrimLeft(str);
}
-void CFX_WideString::TrimLeft() {
+void WideString::TrimLeft() {
TrimLeft(L"\x09\x0a\x0b\x0c\x0d\x20");
}
float FX_wtof(const wchar_t* str, int len) {
@@ -1028,28 +1025,30 @@ float FX_wtof(const wchar_t* str, int len) {
return bNegative ? -fraction : fraction;
}
-int CFX_WideString::GetInteger() const {
+int WideString::GetInteger() const {
return m_pData ? FXSYS_wtoi(m_pData->m_String) : 0;
}
-float CFX_WideString::GetFloat() const {
+float WideString::GetFloat() const {
return m_pData ? FX_wtof(m_pData->m_String, m_pData->m_nDataLength) : 0.0f;
}
-std::wostream& operator<<(std::wostream& os, const CFX_WideString& str) {
+std::wostream& operator<<(std::wostream& os, const WideString& str) {
return os.write(str.c_str(), str.GetLength());
}
-std::ostream& operator<<(std::ostream& os, const CFX_WideString& str) {
+std::ostream& operator<<(std::ostream& os, const WideString& str) {
os << str.UTF8Encode();
return os;
}
-std::wostream& operator<<(std::wostream& os, const CFX_WideStringC& str) {
+std::wostream& operator<<(std::wostream& os, const WideStringView& str) {
return os.write(str.unterminated_c_str(), str.GetLength());
}
-std::ostream& operator<<(std::ostream& os, const CFX_WideStringC& str) {
+std::ostream& operator<<(std::ostream& os, const WideStringView& str) {
os << FX_UTF8Encode(str);
return os;
}
+
+} // namespace fxcrt
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
new file mode 100644
index 0000000000..8841c84093
--- /dev/null
+++ b/core/fxcrt/widestring.h
@@ -0,0 +1,277 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_WIDESTRING_H_
+#define CORE_FXCRT_WIDESTRING_H_
+
+#include <functional>
+#include <iterator>
+#include <utility>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_string_data_template.h"
+#include "core/fxcrt/fx_memory.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/string_view_template.h"
+#include "third_party/base/optional.h"
+
+class WideString_ConcatInPlace_Test;
+class fxcrt_WideStringPool_Test;
+
+namespace fxcrt {
+
+class ByteString;
+
+// A mutable string with shared buffers using copy-on-write semantics that
+// avoids the cost of std::string's iterator stability guarantees.
+class WideString {
+ public:
+ using CharType = wchar_t;
+ using const_iterator = const CharType*;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+
+ WideString();
+ WideString(const WideString& other);
+ WideString(WideString&& other) noexcept;
+
+ // Deliberately implicit to avoid calling on every string literal.
+ // NOLINTNEXTLINE(runtime/explicit)
+ WideString(wchar_t ch);
+ // NOLINTNEXTLINE(runtime/explicit)
+ WideString(const wchar_t* ptr);
+
+ // No implicit conversions from byte strings.
+ // NOLINTNEXTLINE(runtime/explicit)
+ WideString(char) = delete;
+
+ WideString(const wchar_t* ptr, FX_STRSIZE len);
+
+ explicit WideString(const WideStringView& str);
+ WideString(const WideStringView& str1, const WideStringView& str2);
+ WideString(const std::initializer_list<WideStringView>& list);
+
+ ~WideString();
+
+ static WideString FromLocal(const ByteStringView& str);
+ static WideString FromCodePage(const ByteStringView& str, uint16_t codepage);
+
+ static WideString FromUTF8(const ByteStringView& str);
+ static WideString FromUTF16LE(const unsigned short* str, FX_STRSIZE len);
+
+ static FX_STRSIZE WStringLength(const unsigned short* str);
+
+ // Explicit conversion to C-style wide string.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ const wchar_t* c_str() const { return m_pData ? m_pData->m_String : L""; }
+
+ // Explicit conversion to WideStringView.
+ // Note: Any subsequent modification of |this| will invalidate the result.
+ WideStringView AsStringView() const {
+ return WideStringView(c_str(), GetLength());
+ }
+
+ // Note: Any subsequent modification of |this| will invalidate iterators.
+ const_iterator begin() const { return m_pData ? m_pData->m_String : nullptr; }
+ const_iterator end() const {
+ return m_pData ? m_pData->m_String + m_pData->m_nDataLength : nullptr;
+ }
+
+ // Note: Any subsequent modification of |this| will invalidate iterators.
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ void clear() { m_pData.Reset(); }
+
+ FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
+ FX_STRSIZE GetStringLength() const {
+ return m_pData ? FXSYS_wcslen(m_pData->m_String) : 0;
+ }
+ bool IsEmpty() const { return !GetLength(); }
+ bool IsValidIndex(FX_STRSIZE index) const { return index < GetLength(); }
+ bool IsValidLength(FX_STRSIZE length) const { return length <= GetLength(); }
+
+ const WideString& operator=(const wchar_t* str);
+ const WideString& operator=(const WideString& stringSrc);
+ const WideString& operator=(const WideStringView& stringSrc);
+
+ const WideString& operator+=(const wchar_t* str);
+ const WideString& operator+=(wchar_t ch);
+ const WideString& operator+=(const WideString& str);
+ const WideString& operator+=(const WideStringView& str);
+
+ bool operator==(const wchar_t* ptr) const;
+ bool operator==(const WideStringView& str) const;
+ bool operator==(const WideString& other) const;
+
+ bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); }
+ bool operator!=(const WideStringView& str) const { return !(*this == str); }
+ bool operator!=(const WideString& other) const { return !(*this == other); }
+
+ bool operator<(const WideString& str) const;
+
+ CharType operator[](const FX_STRSIZE index) const {
+ ASSERT(IsValidIndex(index));
+ return m_pData ? m_pData->m_String[index] : 0;
+ }
+
+ CharType First() const { return GetLength() ? (*this)[0] : 0; }
+ CharType Last() const { return GetLength() ? (*this)[GetLength() - 1] : 0; }
+
+ void SetAt(FX_STRSIZE index, wchar_t c);
+
+ int Compare(const wchar_t* str) const;
+ int Compare(const WideString& str) const;
+ int CompareNoCase(const wchar_t* str) const;
+
+ WideString Mid(FX_STRSIZE first, FX_STRSIZE count) const;
+ WideString Left(FX_STRSIZE count) const;
+ WideString Right(FX_STRSIZE count) const;
+
+ FX_STRSIZE Insert(FX_STRSIZE index, wchar_t ch);
+ FX_STRSIZE InsertAtFront(wchar_t ch) { return Insert(0, ch); }
+ FX_STRSIZE InsertAtBack(wchar_t ch) { return Insert(GetLength(), ch); }
+ FX_STRSIZE Delete(FX_STRSIZE index, FX_STRSIZE count = 1);
+
+ void Format(const wchar_t* lpszFormat, ...);
+ void FormatV(const wchar_t* lpszFormat, va_list argList);
+
+ void MakeLower();
+ void MakeUpper();
+
+ void TrimRight();
+ void TrimRight(wchar_t chTarget);
+ void TrimRight(const WideStringView& pTargets);
+
+ void TrimLeft();
+ void TrimLeft(wchar_t chTarget);
+ void TrimLeft(const WideStringView& pTargets);
+
+ void Reserve(FX_STRSIZE len);
+ wchar_t* GetBuffer(FX_STRSIZE len);
+ void ReleaseBuffer(FX_STRSIZE len);
+
+ int GetInteger() const;
+ float GetFloat() const;
+
+ pdfium::Optional<FX_STRSIZE> Find(const WideStringView& pSub,
+ FX_STRSIZE start = 0) const;
+ pdfium::Optional<FX_STRSIZE> Find(wchar_t ch, FX_STRSIZE start = 0) const;
+
+ bool Contains(const WideStringView& lpszSub, FX_STRSIZE start = 0) const {
+ return Find(lpszSub, start).has_value();
+ }
+
+ bool Contains(char ch, FX_STRSIZE start = 0) const {
+ return Find(ch, start).has_value();
+ }
+
+ FX_STRSIZE Replace(const WideStringView& pOld, const WideStringView& pNew);
+ FX_STRSIZE Remove(wchar_t ch);
+
+ ByteString UTF8Encode() const;
+ ByteString UTF16LE_Encode() const;
+
+ protected:
+ using StringData = CFX_StringDataTemplate<wchar_t>;
+
+ void ReallocBeforeWrite(FX_STRSIZE nLen);
+ void AllocBeforeWrite(FX_STRSIZE nLen);
+ void AllocCopy(WideString& dest,
+ FX_STRSIZE nCopyLen,
+ FX_STRSIZE nCopyIndex) const;
+ void AssignCopy(const wchar_t* pSrcData, FX_STRSIZE nSrcLen);
+ void Concat(const wchar_t* lpszSrcData, FX_STRSIZE nSrcLen);
+
+ // Returns true unless we ran out of space.
+ bool TryVSWPrintf(FX_STRSIZE size, const wchar_t* format, va_list argList);
+
+ CFX_RetainPtr<StringData> m_pData;
+
+ friend WideString_ConcatInPlace_Test;
+ friend fxcrt_WideStringPool_Test;
+};
+
+inline WideString operator+(const WideStringView& str1,
+ const WideStringView& str2) {
+ return WideString(str1, str2);
+}
+inline WideString operator+(const WideStringView& str1, const wchar_t* str2) {
+ return WideString(str1, str2);
+}
+inline WideString operator+(const wchar_t* str1, const WideStringView& str2) {
+ return WideString(str1, str2);
+}
+inline WideString operator+(const WideStringView& str1, wchar_t ch) {
+ return WideString(str1, WideStringView(ch));
+}
+inline WideString operator+(wchar_t ch, const WideStringView& str2) {
+ return WideString(ch, str2);
+}
+inline WideString operator+(const WideString& str1, const WideString& str2) {
+ return WideString(str1.AsStringView(), str2.AsStringView());
+}
+inline WideString operator+(const WideString& str1, wchar_t ch) {
+ return WideString(str1.AsStringView(), WideStringView(ch));
+}
+inline WideString operator+(wchar_t ch, const WideString& str2) {
+ return WideString(ch, str2.AsStringView());
+}
+inline WideString operator+(const WideString& str1, const wchar_t* str2) {
+ return WideString(str1.AsStringView(), str2);
+}
+inline WideString operator+(const wchar_t* str1, const WideString& str2) {
+ return WideString(str1, str2.AsStringView());
+}
+inline WideString operator+(const WideString& str1,
+ const WideStringView& str2) {
+ return WideString(str1.AsStringView(), str2);
+}
+inline WideString operator+(const WideStringView& str1,
+ const WideString& str2) {
+ return WideString(str1, str2.AsStringView());
+}
+inline bool operator==(const wchar_t* lhs, const WideString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator==(const WideStringView& lhs, const WideString& rhs) {
+ return rhs == lhs;
+}
+inline bool operator!=(const wchar_t* lhs, const WideString& rhs) {
+ return rhs != lhs;
+}
+inline bool operator!=(const WideStringView& lhs, const WideString& rhs) {
+ return rhs != lhs;
+}
+
+std::wostream& operator<<(std::wostream& os, const WideString& str);
+std::ostream& operator<<(std::ostream& os, const WideString& str);
+std::wostream& operator<<(std::wostream& os, const WideStringView& str);
+std::ostream& operator<<(std::ostream& os, const WideStringView& str);
+
+} // namespace fxcrt
+
+using WideString = fxcrt::WideString;
+
+uint32_t FX_HashCode_GetW(const WideStringView& str, bool bIgnoreCase);
+
+namespace std {
+
+template <>
+struct hash<WideString> {
+ std::size_t operator()(const WideString& str) const {
+ return FX_HashCode_GetW(str.AsStringView(), false);
+ }
+};
+
+} // namespace std
+
+extern template struct std::hash<WideString>;
+
+#endif // CORE_FXCRT_WIDESTRING_H_
diff --git a/core/fxcrt/cfx_widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 6f3bc0837f..949827f6f1 100644
--- a/core/fxcrt/cfx_widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "core/fxcrt/cfx_widestring.h"
-#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/widestring.h"
#include <algorithm>
#include <vector>
+#include "core/fxcrt/fx_string.h"
#include "testing/gtest/include/gtest/gtest.h"
-TEST(fxcrt, WideStringElementAccess) {
- const CFX_WideString abc(L"abc");
+TEST(WideString, ElementAccess) {
+ const WideString abc(L"abc");
EXPECT_EQ(L'a', abc[0]);
EXPECT_EQ(L'b', abc[1]);
EXPECT_EQ(L'c', abc[2]);
@@ -19,7 +19,7 @@ TEST(fxcrt, WideStringElementAccess) {
EXPECT_DEATH({ abc[4]; }, ".*");
#endif
- CFX_WideString mutable_abc = abc;
+ WideString mutable_abc = abc;
EXPECT_EQ(abc.c_str(), mutable_abc.c_str());
EXPECT_EQ(L'a', mutable_abc[0]);
EXPECT_EQ(L'b', mutable_abc[1]);
@@ -47,11 +47,11 @@ TEST(fxcrt, WideStringElementAccess) {
#endif
}
-TEST(fxcrt, WideStringOperatorLT) {
- CFX_WideString empty;
- CFX_WideString a(L"a");
- CFX_WideString abc(L"\x0110qq"); // Comes before despite endianness.
- CFX_WideString def(L"\x1001qq"); // Comes after despite endianness.
+TEST(WideString, OperatorLT) {
+ WideString empty;
+ WideString a(L"a");
+ WideString abc(L"\x0110qq"); // Comes before despite endianness.
+ WideString def(L"\x1001qq"); // Comes after despite endianness.
EXPECT_FALSE(empty < empty);
EXPECT_FALSE(a < a);
@@ -77,16 +77,16 @@ TEST(fxcrt, WideStringOperatorLT) {
EXPECT_FALSE(def < abc);
}
-TEST(fxcrt, WideStringOperatorEQ) {
- CFX_WideString null_string;
+TEST(WideString, OperatorEQ) {
+ WideString null_string;
EXPECT_TRUE(null_string == null_string);
- CFX_WideString empty_string(L"");
+ WideString empty_string(L"");
EXPECT_TRUE(empty_string == empty_string);
EXPECT_TRUE(empty_string == null_string);
EXPECT_TRUE(null_string == empty_string);
- CFX_WideString deleted_string(L"hello");
+ WideString deleted_string(L"hello");
deleted_string.Delete(0, 5);
EXPECT_TRUE(deleted_string == deleted_string);
EXPECT_TRUE(deleted_string == null_string);
@@ -94,7 +94,7 @@ TEST(fxcrt, WideStringOperatorEQ) {
EXPECT_TRUE(null_string == deleted_string);
EXPECT_TRUE(null_string == empty_string);
- CFX_WideString wide_string(L"hello");
+ WideString wide_string(L"hello");
EXPECT_TRUE(wide_string == wide_string);
EXPECT_FALSE(wide_string == null_string);
EXPECT_FALSE(wide_string == empty_string);
@@ -103,17 +103,17 @@ TEST(fxcrt, WideStringOperatorEQ) {
EXPECT_FALSE(empty_string == wide_string);
EXPECT_FALSE(deleted_string == wide_string);
- CFX_WideString wide_string_same1(L"hello");
+ WideString wide_string_same1(L"hello");
EXPECT_TRUE(wide_string == wide_string_same1);
EXPECT_TRUE(wide_string_same1 == wide_string);
- CFX_WideString wide_string_same2(wide_string);
+ WideString wide_string_same2(wide_string);
EXPECT_TRUE(wide_string == wide_string_same2);
EXPECT_TRUE(wide_string_same2 == wide_string);
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
+ WideString wide_string1(L"he");
+ WideString wide_string2(L"hellp");
+ WideString wide_string3(L"hellod");
EXPECT_FALSE(wide_string == wide_string1);
EXPECT_FALSE(wide_string == wide_string2);
EXPECT_FALSE(wide_string == wide_string3);
@@ -121,8 +121,8 @@ TEST(fxcrt, WideStringOperatorEQ) {
EXPECT_FALSE(wide_string2 == wide_string);
EXPECT_FALSE(wide_string3 == wide_string);
- CFX_WideStringC null_string_c;
- CFX_WideStringC empty_string_c(L"");
+ WideStringView null_string_c;
+ WideStringView empty_string_c(L"");
EXPECT_TRUE(null_string == null_string_c);
EXPECT_TRUE(null_string == empty_string_c);
EXPECT_TRUE(empty_string == null_string_c);
@@ -136,13 +136,13 @@ TEST(fxcrt, WideStringOperatorEQ) {
EXPECT_TRUE(null_string_c == deleted_string);
EXPECT_TRUE(empty_string_c == deleted_string);
- CFX_WideStringC wide_string_c_same1(L"hello");
+ WideStringView wide_string_c_same1(L"hello");
EXPECT_TRUE(wide_string == wide_string_c_same1);
EXPECT_TRUE(wide_string_c_same1 == wide_string);
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
+ WideStringView wide_string_c1(L"he");
+ WideStringView wide_string_c2(L"hellp");
+ WideStringView wide_string_c3(L"hellod");
EXPECT_FALSE(wide_string == wide_string_c1);
EXPECT_FALSE(wide_string == wide_string_c2);
EXPECT_FALSE(wide_string == wide_string_c3);
@@ -180,16 +180,16 @@ TEST(fxcrt, WideStringOperatorEQ) {
EXPECT_FALSE(c_string3 == wide_string);
}
-TEST(fxcrt, WideStringOperatorNE) {
- CFX_WideString null_string;
+TEST(WideString, OperatorNE) {
+ WideString null_string;
EXPECT_FALSE(null_string != null_string);
- CFX_WideString empty_string(L"");
+ WideString empty_string(L"");
EXPECT_FALSE(empty_string != empty_string);
EXPECT_FALSE(empty_string != null_string);
EXPECT_FALSE(null_string != empty_string);
- CFX_WideString deleted_string(L"hello");
+ WideString deleted_string(L"hello");
deleted_string.Delete(0, 5);
EXPECT_FALSE(deleted_string != deleted_string);
EXPECT_FALSE(deleted_string != null_string);
@@ -197,7 +197,7 @@ TEST(fxcrt, WideStringOperatorNE) {
EXPECT_FALSE(null_string != deleted_string);
EXPECT_FALSE(null_string != empty_string);
- CFX_WideString wide_string(L"hello");
+ WideString wide_string(L"hello");
EXPECT_FALSE(wide_string != wide_string);
EXPECT_TRUE(wide_string != null_string);
EXPECT_TRUE(wide_string != empty_string);
@@ -206,17 +206,17 @@ TEST(fxcrt, WideStringOperatorNE) {
EXPECT_TRUE(empty_string != wide_string);
EXPECT_TRUE(deleted_string != wide_string);
- CFX_WideString wide_string_same1(L"hello");
+ WideString wide_string_same1(L"hello");
EXPECT_FALSE(wide_string != wide_string_same1);
EXPECT_FALSE(wide_string_same1 != wide_string);
- CFX_WideString wide_string_same2(wide_string);
+ WideString wide_string_same2(wide_string);
EXPECT_FALSE(wide_string != wide_string_same2);
EXPECT_FALSE(wide_string_same2 != wide_string);
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
+ WideString wide_string1(L"he");
+ WideString wide_string2(L"hellp");
+ WideString wide_string3(L"hellod");
EXPECT_TRUE(wide_string != wide_string1);
EXPECT_TRUE(wide_string != wide_string2);
EXPECT_TRUE(wide_string != wide_string3);
@@ -224,8 +224,8 @@ TEST(fxcrt, WideStringOperatorNE) {
EXPECT_TRUE(wide_string2 != wide_string);
EXPECT_TRUE(wide_string3 != wide_string);
- CFX_WideStringC null_string_c;
- CFX_WideStringC empty_string_c(L"");
+ WideStringView null_string_c;
+ WideStringView empty_string_c(L"");
EXPECT_FALSE(null_string != null_string_c);
EXPECT_FALSE(null_string != empty_string_c);
EXPECT_FALSE(empty_string != null_string_c);
@@ -237,13 +237,13 @@ TEST(fxcrt, WideStringOperatorNE) {
EXPECT_FALSE(null_string_c != empty_string);
EXPECT_FALSE(empty_string_c != empty_string);
- CFX_WideStringC wide_string_c_same1(L"hello");
+ WideStringView wide_string_c_same1(L"hello");
EXPECT_FALSE(wide_string != wide_string_c_same1);
EXPECT_FALSE(wide_string_c_same1 != wide_string);
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
+ WideStringView wide_string_c1(L"he");
+ WideStringView wide_string_c2(L"hellp");
+ WideStringView wide_string_c3(L"hellod");
EXPECT_TRUE(wide_string != wide_string_c1);
EXPECT_TRUE(wide_string != wide_string_c2);
EXPECT_TRUE(wide_string != wide_string_c3);
@@ -281,8 +281,8 @@ TEST(fxcrt, WideStringOperatorNE) {
EXPECT_TRUE(c_string3 != wide_string);
}
-TEST(fxcrt, WideStringConcatInPlace) {
- CFX_WideString fred;
+TEST(WideString, ConcatInPlace) {
+ WideString fred;
fred.Concat(L"FRED", 4);
EXPECT_EQ(L"FRED", fred);
@@ -295,14 +295,14 @@ TEST(fxcrt, WideStringConcatInPlace) {
fred.Concat(L"D", 1);
EXPECT_EQ(L"FRED", fred);
- CFX_WideString copy = fred;
+ WideString copy = fred;
fred.Concat(L"DY", 2);
EXPECT_EQ(L"FREDDY", fred);
EXPECT_EQ(L"FRED", copy);
}
-TEST(fxcrt, WideStringRemove) {
- CFX_WideString freed(L"FREED");
+TEST(WideString, Remove) {
+ WideString freed(L"FREED");
freed.Remove(L'E');
EXPECT_EQ(L"FRD", freed);
freed.Remove(L'F');
@@ -314,13 +314,13 @@ TEST(fxcrt, WideStringRemove) {
freed.Remove(L'R');
EXPECT_EQ(L"", freed);
- CFX_WideString empty;
+ WideString empty;
empty.Remove(L'X');
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringRemoveCopies) {
- CFX_WideString freed(L"FREED");
+TEST(WideString, RemoveCopies) {
+ WideString freed(L"FREED");
const wchar_t* old_buffer = freed.c_str();
// No change with single reference - no copy.
@@ -334,7 +334,7 @@ TEST(fxcrt, WideStringRemoveCopies) {
EXPECT_EQ(old_buffer, freed.c_str());
// No change with multiple references - no copy.
- CFX_WideString shared(freed);
+ WideString shared(freed);
freed.Remove(L'Q');
EXPECT_EQ(L"FRD", freed);
EXPECT_EQ(old_buffer, freed.c_str());
@@ -348,8 +348,8 @@ TEST(fxcrt, WideStringRemoveCopies) {
EXPECT_EQ(old_buffer, shared.c_str());
}
-TEST(fxcrt, WideStringReplace) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Replace) {
+ WideString fred(L"FRED");
fred.Replace(L"FR", L"BL");
EXPECT_EQ(L"BLED", fred);
fred.Replace(L"D", L"DDY");
@@ -366,8 +366,8 @@ TEST(fxcrt, WideStringReplace) {
EXPECT_EQ(L"", fred);
}
-TEST(fxcrt, WideStringInsert) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Insert) {
+ WideString fred(L"FRED");
EXPECT_EQ(5u, fred.Insert(0, 'S'));
EXPECT_EQ(L"SFRED", fred);
EXPECT_EQ(6u, fred.Insert(1, 'T'));
@@ -379,20 +379,20 @@ TEST(fxcrt, WideStringInsert) {
EXPECT_EQ(8u, fred.Insert(12, 'P'));
EXPECT_EQ(L"STFRUEDV", fred);
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(1u, empty.Insert(0, 'X'));
EXPECT_EQ(L"X", empty);
}
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(0u, empty.Insert(5, 'X'));
EXPECT_NE(L"X", empty);
}
}
-TEST(fxcrt, WideStringInsertAtFrontAndInsertAtBack) {
+TEST(WideString, InsertAtFrontAndInsertAtBack) {
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(1u, empty.InsertAtFront('D'));
EXPECT_EQ(L"D", empty);
EXPECT_EQ(2u, empty.InsertAtFront('E'));
@@ -403,7 +403,7 @@ TEST(fxcrt, WideStringInsertAtFrontAndInsertAtBack) {
EXPECT_EQ(L"FRED", empty);
}
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(1u, empty.InsertAtBack('F'));
EXPECT_EQ(L"F", empty);
EXPECT_EQ(2u, empty.InsertAtBack('R'));
@@ -414,7 +414,7 @@ TEST(fxcrt, WideStringInsertAtFrontAndInsertAtBack) {
EXPECT_EQ(L"FRED", empty);
}
{
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(1u, empty.InsertAtBack('E'));
EXPECT_EQ(L"E", empty);
EXPECT_EQ(2u, empty.InsertAtFront('R'));
@@ -426,8 +426,8 @@ TEST(fxcrt, WideStringInsertAtFrontAndInsertAtBack) {
}
}
-TEST(fxcrt, WideStringDelete) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Delete) {
+ WideString fred(L"FRED");
EXPECT_EQ(4u, fred.Delete(0, 0));
EXPECT_EQ(L"FRED", fred);
EXPECT_EQ(2u, fred.Delete(0, 2));
@@ -439,15 +439,15 @@ TEST(fxcrt, WideStringDelete) {
EXPECT_EQ(0u, fred.Delete(0));
EXPECT_EQ(L"", fred);
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(0u, empty.Delete(0));
EXPECT_EQ(L"", empty);
EXPECT_EQ(0u, empty.Delete(1));
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringMid) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Mid) {
+ WideString fred(L"FRED");
EXPECT_EQ(L"", fred.Mid(0, 0));
EXPECT_EQ(L"", fred.Mid(3, 0));
EXPECT_EQ(L"FRED", fred.Mid(0, 4));
@@ -465,12 +465,12 @@ TEST(fxcrt, WideStringMid) {
EXPECT_EQ(L"", fred.Mid(1, 4));
EXPECT_EQ(L"", fred.Mid(4, 1));
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(L"", empty.Mid(0, 0));
}
-TEST(fxcrt, WideStringLeft) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Left) {
+ WideString fred(L"FRED");
EXPECT_EQ(L"", fred.Left(0));
EXPECT_EQ(L"F", fred.Left(1));
EXPECT_EQ(L"FR", fred.Left(2));
@@ -479,13 +479,13 @@ TEST(fxcrt, WideStringLeft) {
EXPECT_EQ(L"", fred.Left(5));
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(L"", empty.Left(0));
EXPECT_EQ(L"", empty.Left(1));
}
-TEST(fxcrt, WideStringRight) {
- CFX_WideString fred(L"FRED");
+TEST(WideString, Right) {
+ WideString fred(L"FRED");
EXPECT_EQ(L"", fred.Right(0));
EXPECT_EQ(L"D", fred.Right(1));
EXPECT_EQ(L"ED", fred.Right(2));
@@ -494,29 +494,29 @@ TEST(fxcrt, WideStringRight) {
EXPECT_EQ(L"", fred.Right(5));
- CFX_WideString empty;
+ WideString empty;
EXPECT_EQ(L"", empty.Right(0));
EXPECT_EQ(L"", empty.Right(1));
}
-TEST(fxcrt, WideStringFind) {
- CFX_WideString null_string;
+TEST(WideString, Find) {
+ WideString null_string;
EXPECT_FALSE(null_string.Find(L'a').has_value());
EXPECT_FALSE(null_string.Find(L'\0').has_value());
- CFX_WideString empty_string(L"");
+ WideString empty_string(L"");
EXPECT_FALSE(empty_string.Find(L'a').has_value());
EXPECT_FALSE(empty_string.Find(L'\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_WideString single_string(L"a");
+ WideString single_string(L"a");
result = single_string.Find(L'a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.Find(L'b').has_value());
EXPECT_FALSE(single_string.Find(L'\0').has_value());
- CFX_WideString longer_string(L"abccc");
+ WideString longer_string(L"abccc");
result = longer_string.Find(L'a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -539,7 +539,7 @@ TEST(fxcrt, WideStringFind) {
EXPECT_EQ(3u, result.value());
EXPECT_FALSE(longer_string.Find(L"d").has_value());
- CFX_WideString hibyte_string(
+ WideString hibyte_string(
L"ab\xff8c"
L"def");
result = hibyte_string.Find(L'\xff8c');
@@ -547,22 +547,22 @@ TEST(fxcrt, WideStringFind) {
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, WideStringUpperLower) {
- CFX_WideString fred(L"F-Re.42D");
+TEST(WideString, UpperLower) {
+ WideString fred(L"F-Re.42D");
fred.MakeLower();
EXPECT_EQ(L"f-re.42d", fred);
fred.MakeUpper();
EXPECT_EQ(L"F-RE.42D", fred);
- CFX_WideString empty;
+ WideString empty;
empty.MakeLower();
EXPECT_EQ(L"", empty);
empty.MakeUpper();
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringTrimRight) {
- CFX_WideString fred(L" FRED ");
+TEST(WideString, TrimRight) {
+ WideString fred(L" FRED ");
fred.TrimRight();
EXPECT_EQ(L" FRED", fred);
fred.TrimRight(L'E');
@@ -572,7 +572,7 @@ TEST(fxcrt, WideStringTrimRight) {
fred.TrimRight(L"ERP");
EXPECT_EQ(L" F", fred);
- CFX_WideString blank(L" ");
+ WideString blank(L" ");
blank.TrimRight(L"ERP");
EXPECT_EQ(L" ", blank);
blank.TrimRight(L'E');
@@ -580,7 +580,7 @@ TEST(fxcrt, WideStringTrimRight) {
blank.TrimRight();
EXPECT_EQ(L"", blank);
- CFX_WideString empty;
+ WideString empty;
empty.TrimRight(L"ERP");
EXPECT_EQ(L"", empty);
empty.TrimRight(L'E');
@@ -589,10 +589,10 @@ TEST(fxcrt, WideStringTrimRight) {
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringTrimRightCopies) {
+TEST(WideString, TrimRightCopies) {
{
// With a single reference, no copy takes place.
- CFX_WideString fred(L" FRED ");
+ WideString fred(L" FRED ");
const wchar_t* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(L" FRED", fred);
@@ -600,8 +600,8 @@ TEST(fxcrt, WideStringTrimRightCopies) {
}
{
// With multiple references, we must copy.
- CFX_WideString fred(L" FRED ");
- CFX_WideString other_fred = fred;
+ WideString fred(L" FRED ");
+ WideString other_fred = fred;
const wchar_t* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(L" FRED", fred);
@@ -610,8 +610,8 @@ TEST(fxcrt, WideStringTrimRightCopies) {
}
{
// With multiple references, but no modifications, no copy.
- CFX_WideString fred(L"FRED");
- CFX_WideString other_fred = fred;
+ WideString fred(L"FRED");
+ WideString other_fred = fred;
const wchar_t* old_buffer = fred.c_str();
fred.TrimRight();
EXPECT_EQ(L"FRED", fred);
@@ -620,8 +620,8 @@ TEST(fxcrt, WideStringTrimRightCopies) {
}
}
-TEST(fxcrt, WideStringTrimLeft) {
- CFX_WideString fred(L" FRED ");
+TEST(WideString, TrimLeft) {
+ WideString fred(L" FRED ");
fred.TrimLeft();
EXPECT_EQ(L"FRED ", fred);
fred.TrimLeft(L'E');
@@ -631,7 +631,7 @@ TEST(fxcrt, WideStringTrimLeft) {
fred.TrimLeft(L"ERP");
EXPECT_EQ(L"D ", fred);
- CFX_WideString blank(L" ");
+ WideString blank(L" ");
blank.TrimLeft(L"ERP");
EXPECT_EQ(L" ", blank);
blank.TrimLeft(L'E');
@@ -639,7 +639,7 @@ TEST(fxcrt, WideStringTrimLeft) {
blank.TrimLeft();
EXPECT_EQ(L"", blank);
- CFX_WideString empty;
+ WideString empty;
empty.TrimLeft(L"ERP");
EXPECT_EQ(L"", empty);
empty.TrimLeft(L'E');
@@ -648,10 +648,10 @@ TEST(fxcrt, WideStringTrimLeft) {
EXPECT_EQ(L"", empty);
}
-TEST(fxcrt, WideStringTrimLeftCopies) {
+TEST(WideString, TrimLeftCopies) {
{
// With a single reference, no copy takes place.
- CFX_WideString fred(L" FRED ");
+ WideString fred(L" FRED ");
const wchar_t* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ(L"FRED ", fred);
@@ -659,8 +659,8 @@ TEST(fxcrt, WideStringTrimLeftCopies) {
}
{
// With multiple references, we must copy.
- CFX_WideString fred(L" FRED ");
- CFX_WideString other_fred = fred;
+ WideString fred(L" FRED ");
+ WideString other_fred = fred;
const wchar_t* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ(L"FRED ", fred);
@@ -669,8 +669,8 @@ TEST(fxcrt, WideStringTrimLeftCopies) {
}
{
// With multiple references, but no modifications, no copy.
- CFX_WideString fred(L"FRED");
- CFX_WideString other_fred = fred;
+ WideString fred(L"FRED");
+ WideString other_fred = fred;
const wchar_t* old_buffer = fred.c_str();
fred.TrimLeft();
EXPECT_EQ(L"FRED", fred);
@@ -679,9 +679,9 @@ TEST(fxcrt, WideStringTrimLeftCopies) {
}
}
-TEST(fxcrt, WideStringReserve) {
+TEST(WideString, Reserve) {
{
- CFX_WideString str;
+ WideString str;
str.Reserve(6);
const wchar_t* old_buffer = str.c_str();
str += L"ABCDEF";
@@ -690,7 +690,7 @@ TEST(fxcrt, WideStringReserve) {
EXPECT_NE(old_buffer, str.c_str());
}
{
- CFX_WideString str(L"A");
+ WideString str(L"A");
str.Reserve(6);
const wchar_t* old_buffer = str.c_str();
str += L"BCDEF";
@@ -700,16 +700,16 @@ TEST(fxcrt, WideStringReserve) {
}
}
-TEST(fxcrt, WideStringGetBuffer) {
+TEST(WideString, GetBuffer) {
{
- CFX_WideString str;
+ WideString str;
wchar_t* buffer = str.GetBuffer(12);
wcscpy(buffer, L"clams");
str.ReleaseBuffer(str.GetStringLength());
EXPECT_EQ(L"clams", str);
}
{
- CFX_WideString str(L"cl");
+ WideString str(L"cl");
wchar_t* buffer = str.GetBuffer(12);
wcscpy(buffer + 2, L"ams");
str.ReleaseBuffer(str.GetStringLength());
@@ -717,9 +717,9 @@ TEST(fxcrt, WideStringGetBuffer) {
}
}
-TEST(fxcrt, WideStringReleaseBuffer) {
+TEST(WideString, ReleaseBuffer) {
{
- CFX_WideString str;
+ WideString str;
str.Reserve(12);
str += L"clams";
const wchar_t* old_buffer = str.c_str();
@@ -728,7 +728,7 @@ TEST(fxcrt, WideStringReleaseBuffer) {
EXPECT_EQ(L"clam", str);
}
{
- CFX_WideString str(L"c");
+ WideString str(L"c");
str.Reserve(12);
str += L"lams";
const wchar_t* old_buffer = str.c_str();
@@ -737,7 +737,7 @@ TEST(fxcrt, WideStringReleaseBuffer) {
EXPECT_EQ(L"clam", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Reserve(200);
str += L"clams";
const wchar_t* old_buffer = str.c_str();
@@ -746,7 +746,7 @@ TEST(fxcrt, WideStringReleaseBuffer) {
EXPECT_EQ(L"clam", str);
}
{
- CFX_WideString str(L"c");
+ WideString str(L"c");
str.Reserve(200);
str += L"lams";
const wchar_t* old_buffer = str.c_str();
@@ -756,16 +756,16 @@ TEST(fxcrt, WideStringReleaseBuffer) {
}
}
-TEST(fxcrt, WideStringEmptyReverseIterator) {
- CFX_WideString empty;
+TEST(WideString, EmptyReverseIterator) {
+ WideString empty;
auto iter = empty.rbegin();
EXPECT_TRUE(iter == empty.rend());
EXPECT_FALSE(iter != empty.rend());
EXPECT_FALSE(iter < empty.rend());
}
-TEST(fxcrt, WideStringOneCharReverseIterator) {
- CFX_WideString one_str(L"a");
+TEST(WideString, OneCharReverseIterator) {
+ WideString one_str(L"a");
auto iter = one_str.rbegin();
EXPECT_FALSE(iter == one_str.rend());
EXPECT_TRUE(iter != one_str.rend());
@@ -778,8 +778,8 @@ TEST(fxcrt, WideStringOneCharReverseIterator) {
EXPECT_FALSE(iter < one_str.rend());
}
-TEST(fxcrt, WideStringMultiCharReverseIterator) {
- CFX_WideString multi_str(L"abcd");
+TEST(WideString, MultiCharReverseIterator) {
+ WideString multi_str(L"abcd");
auto iter = multi_str.rbegin();
EXPECT_FALSE(iter == multi_str.rend());
@@ -823,17 +823,17 @@ TEST(fxcrt, WideStringMultiCharReverseIterator) {
EXPECT_TRUE(iter == multi_str.rbegin());
}
-TEST(fxcrt, WideStringUTF16LE_Encode) {
+TEST(WideString, UTF16LE_Encode) {
struct UTF16LEEncodeCase {
- CFX_WideString ws;
- CFX_ByteString bs;
+ WideString ws;
+ ByteString bs;
} utf16le_encode_cases[] = {
- {L"", CFX_ByteString("\0\0", 2)},
- {L"abc", CFX_ByteString("a\0b\0c\0\0\0", 8)},
- {L"abcdef", CFX_ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14)},
- {L"abc\0def", CFX_ByteString("a\0b\0c\0\0\0", 8)},
- {L"\xaabb\xccdd", CFX_ByteString("\xbb\xaa\xdd\xcc\0\0", 6)},
- {L"\x3132\x6162", CFX_ByteString("\x32\x31\x62\x61\0\0", 6)},
+ {L"", ByteString("\0\0", 2)},
+ {L"abc", ByteString("a\0b\0c\0\0\0", 8)},
+ {L"abcdef", ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14)},
+ {L"abc\0def", ByteString("a\0b\0c\0\0\0", 8)},
+ {L"\xaabb\xccdd", ByteString("\xbb\xaa\xdd\xcc\0\0", 6)},
+ {L"\x3132\x6162", ByteString("\x32\x31\x62\x61\0\0", 6)},
};
for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) {
@@ -843,27 +843,27 @@ TEST(fxcrt, WideStringUTF16LE_Encode) {
}
}
-TEST(fxcrt, WideStringCFromVector) {
- std::vector<CFX_WideStringC::UnsignedType> null_vec;
- CFX_WideStringC null_string(null_vec);
+TEST(WideStringView, FromVector) {
+ std::vector<WideStringView::UnsignedType> null_vec;
+ WideStringView null_string(null_vec);
EXPECT_EQ(0u, null_string.GetLength());
- std::vector<CFX_WideStringC::UnsignedType> lower_a_vec(
- 10, static_cast<CFX_WideStringC::UnsignedType>(L'a'));
- CFX_WideStringC lower_a_string(lower_a_vec);
+ std::vector<WideStringView::UnsignedType> lower_a_vec(
+ 10, static_cast<WideStringView::UnsignedType>(L'a'));
+ WideStringView lower_a_string(lower_a_vec);
EXPECT_EQ(10u, lower_a_string.GetLength());
EXPECT_EQ(L"aaaaaaaaaa", lower_a_string);
- std::vector<CFX_WideStringC::UnsignedType> cleared_vec;
+ std::vector<WideStringView::UnsignedType> cleared_vec;
cleared_vec.push_back(42);
cleared_vec.pop_back();
- CFX_WideStringC cleared_string(cleared_vec);
+ WideStringView cleared_string(cleared_vec);
EXPECT_EQ(0u, cleared_string.GetLength());
EXPECT_EQ(nullptr, cleared_string.raw_str());
}
-TEST(fxcrt, WideStringCElementAccess) {
- CFX_WideStringC abc(L"abc");
+TEST(WideStringView, ElementAccess) {
+ WideStringView abc(L"abc");
EXPECT_EQ(L'a', static_cast<wchar_t>(abc[0]));
EXPECT_EQ(L'b', static_cast<wchar_t>(abc[1]));
EXPECT_EQ(L'c', static_cast<wchar_t>(abc[2]));
@@ -872,11 +872,11 @@ TEST(fxcrt, WideStringCElementAccess) {
#endif
}
-TEST(fxcrt, WideStringCOperatorLT) {
- CFX_WideStringC empty;
- CFX_WideStringC a(L"a");
- CFX_WideStringC abc(L"\x0110qq"); // Comes InsertAtFront despite endianness.
- CFX_WideStringC def(L"\x1001qq"); // Comes InsertAtBack despite endianness.
+TEST(WideStringView, OperatorLT) {
+ WideStringView empty;
+ WideStringView a(L"a");
+ WideStringView abc(L"\x0110qq"); // Comes InsertAtFront despite endianness.
+ WideStringView def(L"\x1001qq"); // Comes InsertAtBack despite endianness.
EXPECT_FALSE(empty < empty);
EXPECT_FALSE(a < a);
@@ -902,21 +902,21 @@ TEST(fxcrt, WideStringCOperatorLT) {
EXPECT_FALSE(def < abc);
}
-TEST(fxcrt, WideStringCOperatorEQ) {
- CFX_WideStringC wide_string_c(L"hello");
+TEST(WideStringView, OperatorEQ) {
+ WideStringView wide_string_c(L"hello");
EXPECT_TRUE(wide_string_c == wide_string_c);
- CFX_WideStringC wide_string_c_same1(L"hello");
+ WideStringView wide_string_c_same1(L"hello");
EXPECT_TRUE(wide_string_c == wide_string_c_same1);
EXPECT_TRUE(wide_string_c_same1 == wide_string_c);
- CFX_WideStringC wide_string_c_same2(wide_string_c);
+ WideStringView wide_string_c_same2(wide_string_c);
EXPECT_TRUE(wide_string_c == wide_string_c_same2);
EXPECT_TRUE(wide_string_c_same2 == wide_string_c);
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
+ WideStringView wide_string_c1(L"he");
+ WideStringView wide_string_c2(L"hellp");
+ WideStringView wide_string_c3(L"hellod");
EXPECT_FALSE(wide_string_c == wide_string_c1);
EXPECT_FALSE(wide_string_c == wide_string_c2);
EXPECT_FALSE(wide_string_c == wide_string_c3);
@@ -924,13 +924,13 @@ TEST(fxcrt, WideStringCOperatorEQ) {
EXPECT_FALSE(wide_string_c2 == wide_string_c);
EXPECT_FALSE(wide_string_c3 == wide_string_c);
- CFX_WideString wide_string_same1(L"hello");
+ WideString wide_string_same1(L"hello");
EXPECT_TRUE(wide_string_c == wide_string_same1);
EXPECT_TRUE(wide_string_same1 == wide_string_c);
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
+ WideString wide_string1(L"he");
+ WideString wide_string2(L"hellp");
+ WideString wide_string3(L"hellod");
EXPECT_FALSE(wide_string_c == wide_string1);
EXPECT_FALSE(wide_string_c == wide_string2);
EXPECT_FALSE(wide_string_c == wide_string3);
@@ -954,21 +954,21 @@ TEST(fxcrt, WideStringCOperatorEQ) {
EXPECT_FALSE(c_string3 == wide_string_c);
}
-TEST(fxcrt, WideStringCOperatorNE) {
- CFX_WideStringC wide_string_c(L"hello");
+TEST(WideStringView, OperatorNE) {
+ WideStringView wide_string_c(L"hello");
EXPECT_FALSE(wide_string_c != wide_string_c);
- CFX_WideStringC wide_string_c_same1(L"hello");
+ WideStringView wide_string_c_same1(L"hello");
EXPECT_FALSE(wide_string_c != wide_string_c_same1);
EXPECT_FALSE(wide_string_c_same1 != wide_string_c);
- CFX_WideStringC wide_string_c_same2(wide_string_c);
+ WideStringView wide_string_c_same2(wide_string_c);
EXPECT_FALSE(wide_string_c != wide_string_c_same2);
EXPECT_FALSE(wide_string_c_same2 != wide_string_c);
- CFX_WideStringC wide_string_c1(L"he");
- CFX_WideStringC wide_string_c2(L"hellp");
- CFX_WideStringC wide_string_c3(L"hellod");
+ WideStringView wide_string_c1(L"he");
+ WideStringView wide_string_c2(L"hellp");
+ WideStringView wide_string_c3(L"hellod");
EXPECT_TRUE(wide_string_c != wide_string_c1);
EXPECT_TRUE(wide_string_c != wide_string_c2);
EXPECT_TRUE(wide_string_c != wide_string_c3);
@@ -976,13 +976,13 @@ TEST(fxcrt, WideStringCOperatorNE) {
EXPECT_TRUE(wide_string_c2 != wide_string_c);
EXPECT_TRUE(wide_string_c3 != wide_string_c);
- CFX_WideString wide_string_same1(L"hello");
+ WideString wide_string_same1(L"hello");
EXPECT_FALSE(wide_string_c != wide_string_same1);
EXPECT_FALSE(wide_string_same1 != wide_string_c);
- CFX_WideString wide_string1(L"he");
- CFX_WideString wide_string2(L"hellp");
- CFX_WideString wide_string3(L"hellod");
+ WideString wide_string1(L"he");
+ WideString wide_string2(L"hellp");
+ WideString wide_string3(L"hellod");
EXPECT_TRUE(wide_string_c != wide_string1);
EXPECT_TRUE(wide_string_c != wide_string2);
EXPECT_TRUE(wide_string_c != wide_string3);
@@ -1006,24 +1006,24 @@ TEST(fxcrt, WideStringCOperatorNE) {
EXPECT_TRUE(c_string3 != wide_string_c);
}
-TEST(fxcrt, WideStringCFind) {
- CFX_WideStringC null_string;
+TEST(WideStringView, Find) {
+ WideStringView null_string;
EXPECT_FALSE(null_string.Find(L'a').has_value());
EXPECT_FALSE(null_string.Find(L'\0').has_value());
- CFX_WideStringC empty_string(L"");
+ WideStringView empty_string(L"");
EXPECT_FALSE(empty_string.Find(L'a').has_value());
EXPECT_FALSE(empty_string.Find(L'\0').has_value());
pdfium::Optional<FX_STRSIZE> result;
- CFX_WideStringC single_string(L"a");
+ WideStringView single_string(L"a");
result = single_string.Find(L'a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
EXPECT_FALSE(single_string.Find(L'b').has_value());
EXPECT_FALSE(single_string.Find(L'\0').has_value());
- CFX_WideStringC longer_string(L"abccc");
+ WideStringView longer_string(L"abccc");
result = longer_string.Find(L'a');
ASSERT_TRUE(result.has_value());
EXPECT_EQ(0u, result.value());
@@ -1033,7 +1033,7 @@ TEST(fxcrt, WideStringCFind) {
EXPECT_FALSE(longer_string.Find(L'd').has_value());
EXPECT_FALSE(longer_string.Find(L'\0').has_value());
- CFX_WideStringC hibyte_string(
+ WideStringView hibyte_string(
L"ab\xFF8c"
L"def");
result = hibyte_string.Find(L'\xFF8c');
@@ -1041,8 +1041,8 @@ TEST(fxcrt, WideStringCFind) {
EXPECT_EQ(2u, result.value());
}
-TEST(fxcrt, WideStringCNullIterator) {
- CFX_WideStringC null_str;
+TEST(WideStringView, NullIterator) {
+ WideStringView null_str;
int32_t sum = 0;
bool any_present = false;
for (const auto& c : null_str) {
@@ -1053,8 +1053,8 @@ TEST(fxcrt, WideStringCNullIterator) {
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, WideStringCEmptyIterator) {
- CFX_WideStringC empty_str(L"");
+TEST(WideStringView, EmptyIterator) {
+ WideStringView empty_str(L"");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : empty_str) {
@@ -1065,8 +1065,8 @@ TEST(fxcrt, WideStringCEmptyIterator) {
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, WideStringCOneCharIterator) {
- CFX_WideStringC one_str(L"a");
+TEST(WideStringView, OneCharIterator) {
+ WideStringView one_str(L"a");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1077,8 +1077,8 @@ TEST(fxcrt, WideStringCOneCharIterator) {
EXPECT_EQ(static_cast<int32_t>(L'a'), sum);
}
-TEST(fxcrt, WideStringCMultiCharIterator) {
- CFX_WideStringC one_str(L"abc");
+TEST(WideStringView, MultiCharIterator) {
+ WideStringView one_str(L"abc");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1089,16 +1089,16 @@ TEST(fxcrt, WideStringCMultiCharIterator) {
EXPECT_EQ(static_cast<int32_t>(L'a' + L'b' + L'c'), sum);
}
-TEST(fxcrt, WideStringCEmptyReverseIterator) {
- CFX_WideStringC empty;
+TEST(WideStringView, EmptyReverseIterator) {
+ WideStringView empty;
auto iter = empty.rbegin();
EXPECT_TRUE(iter == empty.rend());
EXPECT_FALSE(iter != empty.rend());
EXPECT_FALSE(iter < empty.rend());
}
-TEST(fxcrt, WideStringCOneCharReverseIterator) {
- CFX_WideStringC one_str(L"a");
+TEST(WideStringView, OneCharReverseIterator) {
+ WideStringView one_str(L"a");
auto iter = one_str.rbegin();
EXPECT_FALSE(iter == one_str.rend());
EXPECT_TRUE(iter != one_str.rend());
@@ -1111,8 +1111,8 @@ TEST(fxcrt, WideStringCOneCharReverseIterator) {
EXPECT_FALSE(iter < one_str.rend());
}
-TEST(fxcrt, WideStringCMultiCharReverseIterator) {
- CFX_WideStringC multi_str(L"abcd");
+TEST(WideStringView, MultiCharReverseIterator) {
+ WideStringView multi_str(L"abcd");
auto iter = multi_str.rbegin();
EXPECT_FALSE(iter == multi_str.rend());
@@ -1156,8 +1156,8 @@ TEST(fxcrt, WideStringCMultiCharReverseIterator) {
EXPECT_TRUE(iter == multi_str.rbegin());
}
-TEST(fxcrt, WideStringCAnyAllNoneOf) {
- CFX_WideStringC str(L"aaaaaaaaaaaaaaaaab");
+TEST(WideStringView, AnyAllNoneOf) {
+ WideStringView str(L"aaaaaaaaaaaaaaaaab");
EXPECT_FALSE(std::all_of(str.begin(), str.end(),
[](const wchar_t& c) { return c == L'a'; }));
@@ -1172,112 +1172,112 @@ TEST(fxcrt, WideStringCAnyAllNoneOf) {
EXPECT_FALSE(pdfium::ContainsValue(str, L'z'));
}
-TEST(fxcrt, WideStringCTrimmedRight) {
- CFX_WideStringC fred(L"FRED");
+TEST(WideStringView, TrimmedRight) {
+ WideStringView fred(L"FRED");
EXPECT_EQ(L"FRED", fred.TrimmedRight(L'E'));
EXPECT_EQ(L"FRE", fred.TrimmedRight(L'D'));
- CFX_WideStringC fredd(L"FREDD");
+ WideStringView fredd(L"FREDD");
EXPECT_EQ(L"FRE", fred.TrimmedRight(L'D'));
}
-TEST(fxcrt, WideStringFormatWidth) {
+TEST(WideString, FormatWidth) {
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%5d", 1);
EXPECT_EQ(L" 1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%d", 1);
EXPECT_EQ(L"1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%*d", 5, 1);
EXPECT_EQ(L" 1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%-1d", 1);
EXPECT_EQ(L"1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%0d", 1);
EXPECT_EQ(L"1", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%1048576d", 1);
EXPECT_EQ(L"", str);
}
}
-TEST(fxcrt, WideStringFormatPrecision) {
+TEST(WideString, FormatPrecision) {
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%.2f", 1.12345);
EXPECT_EQ(L"1.12", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%.*f", 3, 1.12345);
EXPECT_EQ(L"1.123", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%f", 1.12345);
EXPECT_EQ(L"1.123450", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%-1f", 1.12345);
EXPECT_EQ(L"1.123450", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%0f", 1.12345);
EXPECT_EQ(L"1.123450", str);
}
{
- CFX_WideString str;
+ WideString str;
str.Format(L"%.1048576f", 1.2);
EXPECT_EQ(L"", str);
}
}
-TEST(fxcrt, WideStringFormatOutOfRangeChar) {
- CFX_WideString str;
+TEST(WideString, FormatOutOfRangeChar) {
+ WideString str;
str.Format(L"unsupported char '%c'", 0x00FF00FF);
}
-TEST(fxcrt, EmptyWideString) {
- CFX_WideString empty_str;
+TEST(WideString, Empty) {
+ WideString empty_str;
EXPECT_TRUE(empty_str.IsEmpty());
EXPECT_EQ(0u, empty_str.GetLength());
const wchar_t* cstr = empty_str.c_str();
EXPECT_EQ(0u, FXSYS_wcslen(cstr));
}
-TEST(fxcrt, WidStringInitializerList) {
- CFX_WideString many_str({L"clams", L" and ", L"oysters"});
+TEST(CFX_WidString, InitializerList) {
+ WideString many_str({L"clams", L" and ", L"oysters"});
EXPECT_EQ(L"clams and oysters", many_str);
many_str = {L"fish", L" and ", L"chips", L" and ", L"soda"};
EXPECT_EQ(L"fish and chips and soda", many_str);
}
-TEST(fxcrt, WideStringNullIterator) {
- CFX_WideString null_str;
+TEST(WideString, NullIterator) {
+ WideString null_str;
int32_t sum = 0;
bool any_present = false;
for (const auto& c : null_str) {
@@ -1288,8 +1288,8 @@ TEST(fxcrt, WideStringNullIterator) {
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, WideStringEmptyIterator) {
- CFX_WideString empty_str(L"");
+TEST(WideString, EmptyIterator) {
+ WideString empty_str(L"");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : empty_str) {
@@ -1300,8 +1300,8 @@ TEST(fxcrt, WideStringEmptyIterator) {
EXPECT_EQ(0, sum);
}
-TEST(fxcrt, WideStringOneCharIterator) {
- CFX_WideString one_str(L"a");
+TEST(WideString, OneCharIterator) {
+ WideString one_str(L"a");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1312,8 +1312,8 @@ TEST(fxcrt, WideStringOneCharIterator) {
EXPECT_EQ(static_cast<int32_t>(L'a'), sum);
}
-TEST(fxcrt, WideStringMultiCharIterator) {
- CFX_WideString one_str(L"abc");
+TEST(WideString, MultiCharIterator) {
+ WideString one_str(L"abc");
int32_t sum = 0;
bool any_present = false;
for (const auto& c : one_str) {
@@ -1324,8 +1324,8 @@ TEST(fxcrt, WideStringMultiCharIterator) {
EXPECT_EQ(static_cast<int32_t>(L'a' + L'b' + L'c'), sum);
}
-TEST(fxcrt, WideStringAnyAllNoneOf) {
- CFX_WideString str(L"aaaaaaaaaaaaaaaaab");
+TEST(WideString, AnyAllNoneOf) {
+ WideString str(L"aaaaaaaaaaaaaaaaab");
EXPECT_FALSE(std::all_of(str.begin(), str.end(),
[](const wchar_t& c) { return c == L'a'; }));
@@ -1340,11 +1340,11 @@ TEST(fxcrt, WideStringAnyAllNoneOf) {
EXPECT_FALSE(pdfium::ContainsValue(str, L'z'));
}
-TEST(fxcrt, OStreamWideStringOverload) {
+TEST(WideString, OStreamOverload) {
std::ostringstream stream;
// Basic case, empty string
- CFX_WideString str;
+ WideString str;
stream << str;
EXPECT_EQ("", stream.str());
@@ -1359,7 +1359,7 @@ TEST(fxcrt, OStreamWideStringOverload) {
stream << "abc" << str << "ghi";
EXPECT_EQ("abcdefghi", stream.str());
- // Changing the CFX_WideString does not change the stream it was written to.
+ // Changing the WideString does not change the stream it was written to.
str = L"123";
EXPECT_EQ("abcdefghi", stream.str());
@@ -1370,35 +1370,35 @@ TEST(fxcrt, OStreamWideStringOverload) {
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
- // Writing a CFX_WideString with nulls and no specified length treats it as
+ // Writing a WideString with nulls and no specified length treats it as
// a C-style null-terminated string.
- str = CFX_WideString(stringWithNulls);
+ str = WideString(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream.str("");
stream << str;
EXPECT_EQ(2u, stream.tellp());
- // Writing a CFX_WideString with nulls but specifying its length treats it as
+ // Writing a WideString with nulls but specifying its length treats it as
// a C++-style string.
- str = CFX_WideString(stringWithNulls, 4);
+ str = WideString(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream.str("");
stream << str;
EXPECT_EQ(4u, stream.tellp());
// << operators can be chained.
- CFX_WideString str1(L"abc");
- CFX_WideString str2(L"def");
+ WideString str1(L"abc");
+ WideString str2(L"def");
stream.str("");
stream << str1 << str2;
EXPECT_EQ("abcdef", stream.str());
}
-TEST(fxcrt, WideOStreamWideStringOverload) {
+TEST(WideString, WideOStreamOverload) {
std::wostringstream stream;
// Basic case, empty string
- CFX_WideString str;
+ WideString str;
stream << str;
EXPECT_EQ(L"", stream.str());
@@ -1413,7 +1413,7 @@ TEST(fxcrt, WideOStreamWideStringOverload) {
stream << L"abc" << str << L"ghi";
EXPECT_EQ(L"abcdefghi", stream.str());
- // Changing the CFX_WideString does not change the stream it was written to.
+ // Changing the WideString does not change the stream it was written to.
str = L"123";
EXPECT_EQ(L"abcdefghi", stream.str());
@@ -1424,35 +1424,35 @@ TEST(fxcrt, WideOStreamWideStringOverload) {
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
- // Writing a CFX_WideString with nulls and no specified length treats it as
+ // Writing a WideString with nulls and no specified length treats it as
// a C-style null-terminated string.
- str = CFX_WideString(stringWithNulls);
+ str = WideString(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream.str(L"");
stream << str;
EXPECT_EQ(2u, stream.tellp());
- // Writing a CFX_WideString with nulls but specifying its length treats it as
+ // Writing a WideString with nulls but specifying its length treats it as
// a C++-style string.
- str = CFX_WideString(stringWithNulls, 4);
+ str = WideString(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream.str(L"");
stream << str;
EXPECT_EQ(4u, stream.tellp());
// << operators can be chained.
- CFX_WideString str1(L"abc");
- CFX_WideString str2(L"def");
+ WideString str1(L"abc");
+ WideString str2(L"def");
stream.str(L"");
stream << str1 << str2;
EXPECT_EQ(L"abcdef", stream.str());
}
-TEST(fxcrt, OStreamWideStringCOverload) {
+TEST(WideStringView, OStreamOverload) {
// Basic case, empty string
{
std::ostringstream stream;
- CFX_WideStringC str;
+ WideStringView str;
stream << str;
EXPECT_EQ("", stream.str());
}
@@ -1460,7 +1460,7 @@ TEST(fxcrt, OStreamWideStringCOverload) {
// Basic case, non-empty string
{
std::ostringstream stream;
- CFX_WideStringC str(L"def");
+ WideStringView str(L"def");
stream << "abc" << str << "ghi";
EXPECT_EQ("abcdefghi", stream.str());
}
@@ -1468,15 +1468,15 @@ TEST(fxcrt, OStreamWideStringCOverload) {
// Basic case, wide character
{
std::ostringstream stream;
- CFX_WideStringC str(L"\u20AC");
+ WideStringView str(L"\u20AC");
stream << str;
EXPECT_EQ("\u20AC", stream.str());
}
- // Changing the CFX_WideStringC does not change the stream it was written to.
+ // Changing the WideStringView does not change the stream it was written to.
{
std::ostringstream stream;
- CFX_WideStringC str(L"abc");
+ WideStringView str(L"abc");
stream << str;
str = L"123";
EXPECT_EQ("abc", stream.str());
@@ -1485,7 +1485,7 @@ TEST(fxcrt, OStreamWideStringCOverload) {
// Writing it again to the stream will use the latest value.
{
std::ostringstream stream;
- CFX_WideStringC str(L"abc");
+ WideStringView str(L"abc");
stream << str;
stream.str("");
str = L"123";
@@ -1493,24 +1493,24 @@ TEST(fxcrt, OStreamWideStringCOverload) {
EXPECT_EQ("123", stream.str());
}
- // Writing a CFX_WideStringC with nulls and no specified length treats it as
+ // Writing a WideStringView with nulls and no specified length treats it as
// a C-style null-terminated string.
{
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
std::ostringstream stream;
- CFX_WideStringC str(stringWithNulls);
+ WideStringView str(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream << str;
EXPECT_EQ(2u, stream.tellp());
str = L"";
}
- // Writing a CFX_WideStringC with nulls but specifying its length treats it as
+ // Writing a WideStringView with nulls but specifying its length treats it as
// a C++-style string.
{
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
std::ostringstream stream;
- CFX_WideStringC str(stringWithNulls, 4);
+ WideStringView str(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream << str;
EXPECT_EQ(4u, stream.tellp());
@@ -1520,18 +1520,18 @@ TEST(fxcrt, OStreamWideStringCOverload) {
// << operators can be chained.
{
std::ostringstream stream;
- CFX_WideStringC str1(L"abc");
- CFX_WideStringC str2(L"def");
+ WideStringView str1(L"abc");
+ WideStringView str2(L"def");
stream << str1 << str2;
EXPECT_EQ("abcdef", stream.str());
}
}
-TEST(fxcrt, WideOStreamWideStringCOverload) {
+TEST(WideStringView, WideOStreamOverload) {
// Basic case, empty string
{
std::wostringstream stream;
- CFX_WideStringC str;
+ WideStringView str;
stream << str;
EXPECT_EQ(L"", stream.str());
}
@@ -1539,7 +1539,7 @@ TEST(fxcrt, WideOStreamWideStringCOverload) {
// Basic case, non-empty string
{
std::wostringstream stream;
- CFX_WideStringC str(L"def");
+ WideStringView str(L"def");
stream << "abc" << str << "ghi";
EXPECT_EQ(L"abcdefghi", stream.str());
}
@@ -1547,15 +1547,15 @@ TEST(fxcrt, WideOStreamWideStringCOverload) {
// Basic case, wide character
{
std::wostringstream stream;
- CFX_WideStringC str(L"\u20AC");
+ WideStringView str(L"\u20AC");
stream << str;
EXPECT_EQ(L"\u20AC", stream.str());
}
- // Changing the CFX_WideStringC does not change the stream it was written to.
+ // Changing the WideStringView does not change the stream it was written to.
{
std::wostringstream stream;
- CFX_WideStringC str(L"abc");
+ WideStringView str(L"abc");
stream << str;
str = L"123";
EXPECT_EQ(L"abc", stream.str());
@@ -1564,7 +1564,7 @@ TEST(fxcrt, WideOStreamWideStringCOverload) {
// Writing it again to the stream will use the latest value.
{
std::wostringstream stream;
- CFX_WideStringC str(L"abc");
+ WideStringView str(L"abc");
stream << str;
stream.str(L"");
str = L"123";
@@ -1572,23 +1572,23 @@ TEST(fxcrt, WideOStreamWideStringCOverload) {
EXPECT_EQ(L"123", stream.str());
}
- // Writing a CFX_WideStringC with nulls and no specified length treats it as
+ // Writing a WideStringView with nulls and no specified length treats it as
// a C-style null-terminated string.
{
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
std::wostringstream stream;
- CFX_WideStringC str(stringWithNulls);
+ WideStringView str(stringWithNulls);
EXPECT_EQ(2u, str.GetLength());
stream << str;
EXPECT_EQ(2u, stream.tellp());
}
- // Writing a CFX_WideStringC with nulls but specifying its length treats it as
+ // Writing a WideStringView with nulls but specifying its length treats it as
// a C++-style string.
{
wchar_t stringWithNulls[]{'x', 'y', '\0', 'z'};
std::wostringstream stream;
- CFX_WideStringC str(stringWithNulls, 4);
+ WideStringView str(stringWithNulls, 4);
EXPECT_EQ(4u, str.GetLength());
stream << str;
EXPECT_EQ(4u, stream.tellp());
@@ -1597,8 +1597,8 @@ TEST(fxcrt, WideOStreamWideStringCOverload) {
// << operators can be chained.
{
std::wostringstream stream;
- CFX_WideStringC str1(L"abc");
- CFX_WideStringC str2(L"def");
+ WideStringView str1(L"abc");
+ WideStringView str2(L"def");
stream << str1 << str2;
EXPECT_EQ(L"abcdef", stream.str());
}
diff --git a/core/fxcrt/xml/cfx_saxcontext.h b/core/fxcrt/xml/cfx_saxcontext.h
index f66c76c9cc..d4d74a385b 100644
--- a/core/fxcrt/xml/cfx_saxcontext.h
+++ b/core/fxcrt/xml/cfx_saxcontext.h
@@ -18,7 +18,7 @@ class CFX_SAXContext {
~CFX_SAXContext();
std::ostringstream m_TextBuf;
- CFX_ByteString m_bsTagName;
+ ByteString m_bsTagName;
CFX_SAXItem::Type m_eNode;
};
diff --git a/core/fxcrt/xml/cfx_saxreader.cpp b/core/fxcrt/xml/cfx_saxreader.cpp
index 641dc08688..e2c09d14cc 100644
--- a/core/fxcrt/xml/cfx_saxreader.cpp
+++ b/core/fxcrt/xml/cfx_saxreader.cpp
@@ -293,8 +293,8 @@ void CFX_SAXReader::ParseChar(uint8_t ch) {
m_iEntityStart = -1;
// NOTE: Relies on negative lengths being treated as empty strings.
- CFX_ByteString csEntity(m_Data.data() + iSaveStart + 1,
- CurrentDataIndex() - iSaveStart - 1);
+ ByteString csEntity(m_Data.data() + iSaveStart + 1,
+ CurrentDataIndex() - iSaveStart - 1);
int32_t iLen = csEntity.GetLength();
if (iLen == 0)
return;
@@ -649,7 +649,7 @@ void CFX_SAXReader::NotifyData() {
m_pHandler->OnTagData(
pItem->m_pNode,
m_bCharData ? CFX_SAXItem::Type::CharData : CFX_SAXItem::Type::Text,
- CFX_ByteStringC(m_Data), m_File.m_dwCur + m_dwDataOffset);
+ ByteStringView(m_Data), m_File.m_dwCur + m_dwDataOffset);
}
void CFX_SAXReader::NotifyEnter() {
@@ -662,7 +662,7 @@ void CFX_SAXReader::NotifyEnter() {
if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
- pItem->m_pNode = m_pHandler->OnTagEnter(CFX_ByteStringC(m_Data),
+ pItem->m_pNode = m_pHandler->OnTagEnter(ByteStringView(m_Data),
pItem->m_eNode, m_dwNodePos);
}
}
@@ -677,8 +677,8 @@ void CFX_SAXReader::NotifyAttribute() {
if (pItem->m_eNode == CFX_SAXItem::Type::Tag ||
pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
- m_pHandler->OnTagAttribute(pItem->m_pNode, CFX_ByteStringC(m_Name),
- CFX_ByteStringC(m_Data));
+ m_pHandler->OnTagAttribute(pItem->m_pNode, ByteStringView(m_Name),
+ ByteStringView(m_Data));
}
}
@@ -717,7 +717,7 @@ void CFX_SAXReader::NotifyEnd() {
return;
if (pItem->m_eNode == CFX_SAXItem::Type::Tag)
- m_pHandler->OnTagEnd(pItem->m_pNode, CFX_ByteStringC(m_Data), m_dwNodePos);
+ m_pHandler->OnTagEnd(pItem->m_pNode, ByteStringView(m_Data), m_dwNodePos);
}
void CFX_SAXReader::NotifyTargetData() {
@@ -730,10 +730,10 @@ void CFX_SAXReader::NotifyTargetData() {
if (pItem->m_eNode == CFX_SAXItem::Type::Instruction) {
m_pHandler->OnTargetData(pItem->m_pNode, pItem->m_eNode,
- CFX_ByteStringC(m_Name), m_dwNodePos);
+ ByteStringView(m_Name), m_dwNodePos);
} else if (pItem->m_eNode == CFX_SAXItem::Type::Comment) {
m_pHandler->OnTargetData(pItem->m_pNode, pItem->m_eNode,
- CFX_ByteStringC(m_Data), m_dwNodePos);
+ ByteStringView(m_Data), m_dwNodePos);
}
}
diff --git a/core/fxcrt/xml/cfx_saxreader.h b/core/fxcrt/xml/cfx_saxreader.h
index 3db1c7c80c..51d9e43121 100644
--- a/core/fxcrt/xml/cfx_saxreader.h
+++ b/core/fxcrt/xml/cfx_saxreader.h
@@ -75,24 +75,24 @@ class CFX_SAXReader {
class HandlerIface {
public:
virtual ~HandlerIface() {}
- virtual CFX_SAXContext* OnTagEnter(const CFX_ByteStringC& bsTagName,
+ virtual CFX_SAXContext* OnTagEnter(const ByteStringView& bsTagName,
CFX_SAXItem::Type eType,
uint32_t dwStartPos) = 0;
virtual void OnTagAttribute(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue) = 0;
+ const ByteStringView& bsAttri,
+ const ByteStringView& bsValue) = 0;
virtual void OnTagBreak(CFX_SAXContext* pTag) = 0;
virtual void OnTagData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) = 0;
virtual void OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos) = 0;
virtual void OnTagEnd(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
uint32_t dwEndPos) = 0;
virtual void OnTargetData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) = 0;
};
diff --git a/core/fxcrt/xml/cfx_saxreader_unittest.cpp b/core/fxcrt/xml/cfx_saxreader_unittest.cpp
index 62828500c9..13d06325a7 100644
--- a/core/fxcrt/xml/cfx_saxreader_unittest.cpp
+++ b/core/fxcrt/xml/cfx_saxreader_unittest.cpp
@@ -17,28 +17,28 @@ namespace {
class MockHandler : public CFX_SAXReader::HandlerIface {
public:
MOCK_METHOD3(OnTagEnter,
- CFX_SAXContext*(const CFX_ByteStringC& bsTagName,
+ CFX_SAXContext*(const ByteStringView& bsTagName,
CFX_SAXItem::Type eType,
uint32_t dwStartPos));
MOCK_METHOD3(OnTagAttribute,
void(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue));
+ const ByteStringView& bsAttri,
+ const ByteStringView& bsValue));
MOCK_METHOD1(OnTagBreak, void(CFX_SAXContext* pTag));
MOCK_METHOD4(OnTagData,
void(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos));
MOCK_METHOD2(OnTagClose, void(CFX_SAXContext* pTag, uint32_t dwEndPos));
MOCK_METHOD3(OnTagEnd,
void(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
uint32_t dwEndPos));
MOCK_METHOD4(OnTargetData,
void(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos));
};
diff --git a/core/fxcrt/xml/cfx_saxreaderhandler.cpp b/core/fxcrt/xml/cfx_saxreaderhandler.cpp
index b8399ff5cc..d255ce924d 100644
--- a/core/fxcrt/xml/cfx_saxreaderhandler.cpp
+++ b/core/fxcrt/xml/cfx_saxreaderhandler.cpp
@@ -18,7 +18,7 @@ CFX_SAXReaderHandler::CFX_SAXReaderHandler(CFX_ChecksumContext* pContext)
CFX_SAXReaderHandler::~CFX_SAXReaderHandler() {}
CFX_SAXContext* CFX_SAXReaderHandler::OnTagEnter(
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
CFX_SAXItem::Type eType,
uint32_t dwStartPos) {
UpdateChecksum(true);
@@ -38,8 +38,8 @@ CFX_SAXContext* CFX_SAXReaderHandler::OnTagEnter(
}
void CFX_SAXReaderHandler::OnTagAttribute(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue) {
+ const ByteStringView& bsAttri,
+ const ByteStringView& bsValue) {
if (!pTag)
return;
pTag->m_TextBuf << " " << bsAttri << "=\"" << bsValue << "\"";
@@ -55,7 +55,7 @@ void CFX_SAXReaderHandler::OnTagBreak(CFX_SAXContext* pTag) {
void CFX_SAXReaderHandler::OnTagData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) {
if (!pTag)
return;
@@ -75,13 +75,13 @@ void CFX_SAXReaderHandler::OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos) {
if (pTag->m_eNode == CFX_SAXItem::Type::Instruction)
pTag->m_TextBuf << "?>";
else if (pTag->m_eNode == CFX_SAXItem::Type::Tag)
- pTag->m_TextBuf << "></" << pTag->m_bsTagName.AsStringC() << ">";
+ pTag->m_TextBuf << "></" << pTag->m_bsTagName.AsStringView() << ">";
UpdateChecksum(false);
}
void CFX_SAXReaderHandler::OnTagEnd(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
uint32_t dwEndPos) {
if (!pTag)
return;
@@ -92,7 +92,7 @@ void CFX_SAXReaderHandler::OnTagEnd(CFX_SAXContext* pTag,
void CFX_SAXReaderHandler::OnTargetData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) {
if (!pTag && eType != CFX_SAXItem::Type::Comment)
return;
@@ -122,7 +122,7 @@ void CFX_SAXReaderHandler::UpdateChecksum(bool bCheckSpace) {
}
}
if (bUpdata)
- m_pContext->Update(CFX_ByteStringC(pBuffer, iLength));
+ m_pContext->Update(ByteStringView(pBuffer, iLength));
m_SAXContext.m_TextBuf.str("");
}
diff --git a/core/fxcrt/xml/cfx_saxreaderhandler.h b/core/fxcrt/xml/cfx_saxreaderhandler.h
index c5e1dc28b6..263008f1ff 100644
--- a/core/fxcrt/xml/cfx_saxreaderhandler.h
+++ b/core/fxcrt/xml/cfx_saxreaderhandler.h
@@ -18,24 +18,24 @@ class CFX_SAXReaderHandler : public CFX_SAXReader::HandlerIface {
explicit CFX_SAXReaderHandler(CFX_ChecksumContext* pContext);
~CFX_SAXReaderHandler() override;
- CFX_SAXContext* OnTagEnter(const CFX_ByteStringC& bsTagName,
+ CFX_SAXContext* OnTagEnter(const ByteStringView& bsTagName,
CFX_SAXItem::Type eType,
uint32_t dwStartPos) override;
void OnTagAttribute(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue) override;
+ const ByteStringView& bsAttri,
+ const ByteStringView& bsValue) override;
void OnTagBreak(CFX_SAXContext* pTag) override;
void OnTagData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) override;
void OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos) override;
void OnTagEnd(CFX_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
+ const ByteStringView& bsTagName,
uint32_t dwEndPos) override;
void OnTargetData(CFX_SAXContext* pTag,
CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
+ const ByteStringView& bsData,
uint32_t dwStartPos) override;
private:
diff --git a/core/fxcrt/xml/cfx_xmlattributenode.cpp b/core/fxcrt/xml/cfx_xmlattributenode.cpp
index 9ea6756839..6104747793 100644
--- a/core/fxcrt/xml/cfx_xmlattributenode.cpp
+++ b/core/fxcrt/xml/cfx_xmlattributenode.cpp
@@ -8,28 +8,27 @@
#include "core/fxcrt/fx_extension.h"
-CFX_XMLAttributeNode::CFX_XMLAttributeNode(const CFX_WideString& name)
+CFX_XMLAttributeNode::CFX_XMLAttributeNode(const WideString& name)
: CFX_XMLNode(), name_(name) {
ASSERT(name_.GetLength() > 0);
}
CFX_XMLAttributeNode::~CFX_XMLAttributeNode() {}
-bool CFX_XMLAttributeNode::HasAttribute(const CFX_WideString& name) const {
+bool CFX_XMLAttributeNode::HasAttribute(const WideString& name) const {
return attrs_.find(name) != attrs_.end();
}
-CFX_WideString CFX_XMLAttributeNode::GetString(
- const CFX_WideString& name) const {
+WideString CFX_XMLAttributeNode::GetString(const WideString& name) const {
auto it = attrs_.find(name);
- return it != attrs_.end() ? it->second : CFX_WideString();
+ return it != attrs_.end() ? it->second : WideString();
}
-void CFX_XMLAttributeNode::SetString(const CFX_WideString& name,
- const CFX_WideString& value) {
+void CFX_XMLAttributeNode::SetString(const WideString& name,
+ const WideString& value) {
attrs_[name] = value;
}
-void CFX_XMLAttributeNode::RemoveAttribute(const CFX_WideString& name) {
+void CFX_XMLAttributeNode::RemoveAttribute(const WideString& name) {
attrs_.erase(name);
}
diff --git a/core/fxcrt/xml/cfx_xmlattributenode.h b/core/fxcrt/xml/cfx_xmlattributenode.h
index e8f358eb59..1ac9b84db2 100644
--- a/core/fxcrt/xml/cfx_xmlattributenode.h
+++ b/core/fxcrt/xml/cfx_xmlattributenode.h
@@ -15,30 +15,30 @@
class CFX_XMLAttributeNode : public CFX_XMLNode {
public:
- explicit CFX_XMLAttributeNode(const CFX_WideString& name);
+ explicit CFX_XMLAttributeNode(const WideString& name);
~CFX_XMLAttributeNode() override;
// CFX_XMLNode
FX_XMLNODETYPE GetType() const override = 0;
std::unique_ptr<CFX_XMLNode> Clone() override = 0;
- CFX_WideString GetName() const { return name_; }
- const std::map<CFX_WideString, CFX_WideString>& GetAttributes() const {
+ WideString GetName() const { return name_; }
+ const std::map<WideString, WideString>& GetAttributes() const {
return attrs_;
}
- void SetAttributes(const std::map<CFX_WideString, CFX_WideString>& attrs) {
+ void SetAttributes(const std::map<WideString, WideString>& attrs) {
attrs_ = attrs;
}
- bool HasAttribute(const CFX_WideString& name) const;
+ bool HasAttribute(const WideString& name) const;
- void SetString(const CFX_WideString& name, const CFX_WideString& value);
- CFX_WideString GetString(const CFX_WideString& name) const;
+ void SetString(const WideString& name, const WideString& value);
+ WideString GetString(const WideString& name) const;
- void RemoveAttribute(const CFX_WideString& name);
+ void RemoveAttribute(const WideString& name);
private:
- CFX_WideString name_;
- std::map<CFX_WideString, CFX_WideString> attrs_;
+ WideString name_;
+ std::map<WideString, WideString> attrs_;
};
#endif // CORE_FXCRT_XML_CFX_XMLATTRIBUTENODE_H_
diff --git a/core/fxcrt/xml/cfx_xmlchardata.cpp b/core/fxcrt/xml/cfx_xmlchardata.cpp
index 185bd064df..902d139c99 100644
--- a/core/fxcrt/xml/cfx_xmlchardata.cpp
+++ b/core/fxcrt/xml/cfx_xmlchardata.cpp
@@ -8,7 +8,7 @@
#include "third_party/base/ptr_util.h"
-CFX_XMLCharData::CFX_XMLCharData(const CFX_WideString& wsCData)
+CFX_XMLCharData::CFX_XMLCharData(const WideString& wsCData)
: CFX_XMLText(wsCData) {}
CFX_XMLCharData::~CFX_XMLCharData() {}
diff --git a/core/fxcrt/xml/cfx_xmlchardata.h b/core/fxcrt/xml/cfx_xmlchardata.h
index c5c007be90..9a4710fa51 100644
--- a/core/fxcrt/xml/cfx_xmlchardata.h
+++ b/core/fxcrt/xml/cfx_xmlchardata.h
@@ -14,7 +14,7 @@
class CFX_XMLCharData : public CFX_XMLText {
public:
- explicit CFX_XMLCharData(const CFX_WideString& wsCData);
+ explicit CFX_XMLCharData(const WideString& wsCData);
~CFX_XMLCharData() override;
FX_XMLNODETYPE GetType() const override;
diff --git a/core/fxcrt/xml/cfx_xmldoc.cpp b/core/fxcrt/xml/cfx_xmldoc.cpp
index 6fce38cea6..e9a09b761b 100644
--- a/core/fxcrt/xml/cfx_xmldoc.cpp
+++ b/core/fxcrt/xml/cfx_xmldoc.cpp
@@ -53,7 +53,7 @@ void CFX_XMLDoc::SaveXMLNode(
CFX_XMLNode* pNode = (CFX_XMLNode*)pINode;
switch (pNode->GetType()) {
case FX_XMLNODE_Instruction: {
- CFX_WideString ws;
+ WideString ws;
CFX_XMLInstruction* pInstruction = (CFX_XMLInstruction*)pNode;
if (pInstruction->GetName().CompareNoCase(L"xml") == 0) {
ws = L"<?xml version=\"1.0\" encoding=\"";
@@ -66,13 +66,13 @@ void CFX_XMLDoc::SaveXMLNode(
ws += L"UTF-8";
}
ws += L"\"?>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
} else {
ws.Format(L"<?%s", pInstruction->GetName().c_str());
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
for (auto it : pInstruction->GetAttributes()) {
- CFX_WideString wsValue = it.second;
+ WideString wsValue = it.second;
wsValue.Replace(L"&", L"&amp;");
wsValue.Replace(L"<", L"&lt;");
wsValue.Replace(L">", L"&gt;");
@@ -84,28 +84,28 @@ void CFX_XMLDoc::SaveXMLNode(
ws += L"=\"";
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
for (auto target : pInstruction->GetTargetData()) {
ws = L" \"";
ws += target;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
ws = L"?>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
break;
}
case FX_XMLNODE_Element: {
- CFX_WideString ws;
+ WideString ws;
ws = L"<";
ws += static_cast<CFX_XMLElement*>(pNode)->GetName();
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
for (auto it : static_cast<CFX_XMLElement*>(pNode)->GetAttributes()) {
- CFX_WideString wsValue = it.second;
+ WideString wsValue = it.second;
wsValue.Replace(L"&", L"&amp;");
wsValue.Replace(L"<", L"&lt;");
wsValue.Replace(L">", L"&gt;");
@@ -117,11 +117,11 @@ void CFX_XMLDoc::SaveXMLNode(
ws += L"=\"";
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
if (pNode->m_pChild) {
ws = L"\n>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
CFX_XMLNode* pChild = pNode->m_pChild;
while (pChild) {
SaveXMLNode(pXMLStream, static_cast<CFX_XMLNode*>(pChild));
@@ -133,24 +133,24 @@ void CFX_XMLDoc::SaveXMLNode(
} else {
ws = L"\n/>";
}
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_Text: {
- CFX_WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
+ WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
ws.Replace(L"&", L"&amp;");
ws.Replace(L"<", L"&lt;");
ws.Replace(L">", L"&gt;");
ws.Replace(L"\'", L"&apos;");
ws.Replace(L"\"", L"&quot;");
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_CharData: {
- CFX_WideString ws = L"<![CDATA[";
+ WideString ws = L"<![CDATA[";
ws += static_cast<CFX_XMLCharData*>(pNode)->GetText();
ws += L"]]>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_Unknown:
diff --git a/core/fxcrt/xml/cfx_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp
index 5b5fe45561..1317e9a72b 100644
--- a/core/fxcrt/xml/cfx_xmlelement.cpp
+++ b/core/fxcrt/xml/cfx_xmlelement.cpp
@@ -15,7 +15,7 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-CFX_XMLElement::CFX_XMLElement(const CFX_WideString& wsTag)
+CFX_XMLElement::CFX_XMLElement(const WideString& wsTag)
: CFX_XMLAttributeNode(wsTag) {}
CFX_XMLElement::~CFX_XMLElement() {}
@@ -28,7 +28,7 @@ std::unique_ptr<CFX_XMLNode> CFX_XMLElement::Clone() {
auto pClone = pdfium::MakeUnique<CFX_XMLElement>(GetName());
pClone->SetAttributes(GetAttributes());
- CFX_WideString wsText;
+ WideString wsText;
CFX_XMLNode* pChild = m_pChild;
while (pChild) {
switch (pChild->GetType()) {
@@ -44,21 +44,21 @@ std::unique_ptr<CFX_XMLNode> CFX_XMLElement::Clone() {
return std::move(pClone);
}
-CFX_WideString CFX_XMLElement::GetLocalTagName() const {
+WideString CFX_XMLElement::GetLocalTagName() const {
auto pos = GetName().Find(L':');
return pos.has_value()
? GetName().Right(GetName().GetLength() - pos.value() - 1)
: GetName();
}
-CFX_WideString CFX_XMLElement::GetNamespacePrefix() const {
+WideString CFX_XMLElement::GetNamespacePrefix() const {
auto pos = GetName().Find(L':');
- return pos.has_value() ? GetName().Left(pos.value()) : CFX_WideString();
+ return pos.has_value() ? GetName().Left(pos.value()) : WideString();
}
-CFX_WideString CFX_XMLElement::GetNamespaceURI() const {
- CFX_WideString wsAttri(L"xmlns");
- CFX_WideString wsPrefix = GetNamespacePrefix();
+WideString CFX_XMLElement::GetNamespaceURI() const {
+ WideString wsAttri(L"xmlns");
+ WideString wsPrefix = GetNamespacePrefix();
if (wsPrefix.GetLength() > 0) {
wsAttri += L":";
wsAttri += wsPrefix;
@@ -76,10 +76,10 @@ CFX_WideString CFX_XMLElement::GetNamespaceURI() const {
}
return pElement->GetString(wsAttri);
}
- return CFX_WideString();
+ return WideString();
}
-CFX_WideString CFX_XMLElement::GetTextData() const {
+WideString CFX_XMLElement::GetTextData() const {
CFX_WideTextBuf buffer;
CFX_XMLNode* pChild = m_pChild;
while (pChild) {
@@ -96,7 +96,7 @@ CFX_WideString CFX_XMLElement::GetTextData() const {
return buffer.MakeString();
}
-void CFX_XMLElement::SetTextData(const CFX_WideString& wsText) {
+void CFX_XMLElement::SetTextData(const WideString& wsText) {
if (wsText.GetLength() < 1)
return;
InsertChildNode(new CFX_XMLText(wsText));
diff --git a/core/fxcrt/xml/cfx_xmlelement.h b/core/fxcrt/xml/cfx_xmlelement.h
index 20780342af..59e3af6a44 100644
--- a/core/fxcrt/xml/cfx_xmlelement.h
+++ b/core/fxcrt/xml/cfx_xmlelement.h
@@ -15,19 +15,19 @@
class CFX_XMLElement : public CFX_XMLAttributeNode {
public:
- explicit CFX_XMLElement(const CFX_WideString& wsTag);
+ explicit CFX_XMLElement(const WideString& wsTag);
~CFX_XMLElement() override;
// CFX_XMLNode
FX_XMLNODETYPE GetType() const override;
std::unique_ptr<CFX_XMLNode> Clone() override;
- CFX_WideString GetLocalTagName() const;
- CFX_WideString GetNamespacePrefix() const;
- CFX_WideString GetNamespaceURI() const;
+ WideString GetLocalTagName() const;
+ WideString GetNamespacePrefix() const;
+ WideString GetNamespaceURI() const;
- CFX_WideString GetTextData() const;
- void SetTextData(const CFX_WideString& wsText);
+ WideString GetTextData() const;
+ void SetTextData(const WideString& wsText);
};
#endif // CORE_FXCRT_XML_CFX_XMLELEMENT_H_
diff --git a/core/fxcrt/xml/cfx_xmlinstruction.cpp b/core/fxcrt/xml/cfx_xmlinstruction.cpp
index 3c7deda92a..75a4a2eec6 100644
--- a/core/fxcrt/xml/cfx_xmlinstruction.cpp
+++ b/core/fxcrt/xml/cfx_xmlinstruction.cpp
@@ -12,7 +12,7 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-CFX_XMLInstruction::CFX_XMLInstruction(const CFX_WideString& wsTarget)
+CFX_XMLInstruction::CFX_XMLInstruction(const WideString& wsTarget)
: CFX_XMLAttributeNode(wsTarget) {}
CFX_XMLInstruction::~CFX_XMLInstruction() {}
@@ -28,7 +28,7 @@ std::unique_ptr<CFX_XMLNode> CFX_XMLInstruction::Clone() {
return std::move(pClone);
}
-void CFX_XMLInstruction::AppendData(const CFX_WideString& wsData) {
+void CFX_XMLInstruction::AppendData(const WideString& wsData) {
m_TargetData.push_back(wsData);
}
diff --git a/core/fxcrt/xml/cfx_xmlinstruction.h b/core/fxcrt/xml/cfx_xmlinstruction.h
index 99554fc239..ff27dae3a4 100644
--- a/core/fxcrt/xml/cfx_xmlinstruction.h
+++ b/core/fxcrt/xml/cfx_xmlinstruction.h
@@ -15,21 +15,19 @@
class CFX_XMLInstruction : public CFX_XMLAttributeNode {
public:
- explicit CFX_XMLInstruction(const CFX_WideString& wsTarget);
+ explicit CFX_XMLInstruction(const WideString& wsTarget);
~CFX_XMLInstruction() override;
// CFX_XMLNode
FX_XMLNODETYPE GetType() const override;
std::unique_ptr<CFX_XMLNode> Clone() override;
- const std::vector<CFX_WideString>& GetTargetData() const {
- return m_TargetData;
- }
- void AppendData(const CFX_WideString& wsData);
+ const std::vector<WideString>& GetTargetData() const { return m_TargetData; }
+ void AppendData(const WideString& wsData);
void RemoveData(int32_t index);
private:
- std::vector<CFX_WideString> m_TargetData;
+ std::vector<WideString> m_TargetData;
};
#endif // CORE_FXCRT_XML_CFX_XMLINSTRUCTION_H_
diff --git a/core/fxcrt/xml/cfx_xmlnode.cpp b/core/fxcrt/xml/cfx_xmlnode.cpp
index 47b3105f10..7a893af4a0 100644
--- a/core/fxcrt/xml/cfx_xmlnode.cpp
+++ b/core/fxcrt/xml/cfx_xmlnode.cpp
@@ -84,7 +84,7 @@ CFX_XMLNode* CFX_XMLNode::GetPath(const wchar_t* pPath,
if (iLength == 0) {
return nullptr;
}
- CFX_WideString csPath;
+ WideString csPath;
const wchar_t* pStart = pPath;
const wchar_t* pEnd = pPath + iLength;
wchar_t ch;
@@ -105,7 +105,7 @@ CFX_XMLNode* CFX_XMLNode::GetPath(const wchar_t* pPath,
} else if (csPath.Compare(L".") == 0) {
pFind = (CFX_XMLNode*)this;
} else {
- CFX_WideString wsTag;
+ WideString wsTag;
CFX_XMLNode* pNode = m_pChild;
while (pNode) {
if (pNode->GetType() == FX_XMLNODE_Element) {
@@ -334,7 +334,7 @@ void CFX_XMLNode::SaveXMLNode(
CFX_XMLNode* pNode = (CFX_XMLNode*)this;
switch (pNode->GetType()) {
case FX_XMLNODE_Instruction: {
- CFX_WideString ws;
+ WideString ws;
CFX_XMLInstruction* pInstruction = (CFX_XMLInstruction*)pNode;
if (pInstruction->GetName().CompareNoCase(L"xml") == 0) {
ws = L"<?xml version=\"1.0\" encoding=\"";
@@ -347,13 +347,13 @@ void CFX_XMLNode::SaveXMLNode(
ws += L"UTF-8";
}
ws += L"\"?>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
} else {
ws.Format(L"<?%s", pInstruction->GetName().c_str());
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
for (auto it : pInstruction->GetAttributes()) {
- CFX_WideString wsValue = it.second;
+ WideString wsValue = it.second;
wsValue.Replace(L"&", L"&amp;");
wsValue.Replace(L"<", L"&lt;");
wsValue.Replace(L">", L"&gt;");
@@ -365,28 +365,28 @@ void CFX_XMLNode::SaveXMLNode(
ws += L"=\"";
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
for (auto target : pInstruction->GetTargetData()) {
ws = L" \"";
ws += target;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
ws = L"?>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
break;
}
case FX_XMLNODE_Element: {
- CFX_WideString ws;
+ WideString ws;
ws = L"<";
ws += static_cast<CFX_XMLElement*>(pNode)->GetName();
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
for (auto it : static_cast<CFX_XMLElement*>(pNode)->GetAttributes()) {
- CFX_WideString wsValue = it.second;
+ WideString wsValue = it.second;
wsValue.Replace(L"&", L"&amp;");
wsValue.Replace(L"<", L"&lt;");
wsValue.Replace(L">", L"&gt;");
@@ -398,11 +398,11 @@ void CFX_XMLNode::SaveXMLNode(
ws += L"=\"";
ws += wsValue;
ws += L"\"";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
}
if (pNode->m_pChild) {
ws = L"\n>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
CFX_XMLNode* pChild = pNode->m_pChild;
while (pChild) {
pChild->SaveXMLNode(pXMLStream);
@@ -414,24 +414,24 @@ void CFX_XMLNode::SaveXMLNode(
} else {
ws = L"\n/>";
}
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_Text: {
- CFX_WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
+ WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
ws.Replace(L"&", L"&amp;");
ws.Replace(L"<", L"&lt;");
ws.Replace(L">", L"&gt;");
ws.Replace(L"\'", L"&apos;");
ws.Replace(L"\"", L"&quot;");
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_CharData: {
- CFX_WideString ws = L"<![CDATA[";
+ WideString ws = L"<![CDATA[";
ws += static_cast<CFX_XMLCharData*>(pNode)->GetText();
ws += L"]]>";
- pXMLStream->WriteString(ws.AsStringC());
+ pXMLStream->WriteString(ws.AsStringView());
break;
}
case FX_XMLNODE_Unknown:
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp
index ce45481512..280c06d3f1 100644
--- a/core/fxcrt/xml/cfx_xmlparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlparser.cpp
@@ -101,7 +101,7 @@ int32_t CFX_XMLParser::DoParser() {
m_pParent = m_pChild;
if (m_dwCheckStatus != 0x03 && m_NodeStack.size() == 3) {
- CFX_WideString wsTag =
+ WideString wsTag =
static_cast<CFX_XMLElement*>(m_pChild)->GetLocalTagName();
if (wsTag == L"template") {
m_dwCheckStatus |= 0x01;
diff --git a/core/fxcrt/xml/cfx_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h
index 9746d78ae8..f98b658d9a 100644
--- a/core/fxcrt/xml/cfx_xmlparser.h
+++ b/core/fxcrt/xml/cfx_xmlparser.h
@@ -38,8 +38,8 @@ class CFX_XMLParser {
CFX_XMLNode* m_pParent;
CFX_XMLNode* m_pChild;
std::stack<CFX_XMLNode*> m_NodeStack;
- CFX_WideString m_ws1;
- CFX_WideString m_ws2;
+ WideString m_ws1;
+ WideString m_ws2;
FX_XmlSyntaxResult m_syntaxParserResult;
};
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
index bbbc4f4399..d55985240d 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
@@ -623,7 +623,7 @@ void CFX_XMLSyntaxParser::ParseTextChar(wchar_t character) {
m_pCurrentBlock[m_iIndexInBlock++] = character;
m_BlockBuffer.IncrementDataLength();
if (m_iEntityStart > -1 && character == L';') {
- CFX_WideString csEntity = m_BlockBuffer.GetTextData(
+ WideString csEntity = m_BlockBuffer.GetTextData(
m_iEntityStart + 1,
m_BlockBuffer.GetDataLength() - 1 - m_iEntityStart - 1);
int32_t iLen = csEntity.GetLength();
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.h b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
index c59cabae19..d3f4bf2edb 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser.h
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
@@ -50,27 +50,27 @@ class CFX_XMLSyntaxParser {
int32_t GetCurrentNodeNumber() const { return m_iCurrentNodeNum; }
int32_t GetLastNodeNumber() const { return m_iLastNodeNum; }
- CFX_WideString GetTargetName() const {
+ WideString GetTargetName() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetTagName() const {
+ WideString GetTagName() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetAttributeName() const {
+ WideString GetAttributeName() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetAttributeValue() const {
+ WideString GetAttributeValue() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetTextData() const {
+ WideString GetTextData() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- CFX_WideString GetTargetData() const {
+ WideString GetTargetData() const {
return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
diff --git a/core/fxcrt/xml/cfx_xmltext.cpp b/core/fxcrt/xml/cfx_xmltext.cpp
index 4c41fcd9f8..83ad0434bf 100644
--- a/core/fxcrt/xml/cfx_xmltext.cpp
+++ b/core/fxcrt/xml/cfx_xmltext.cpp
@@ -8,7 +8,7 @@
#include "third_party/base/ptr_util.h"
-CFX_XMLText::CFX_XMLText(const CFX_WideString& wsText)
+CFX_XMLText::CFX_XMLText(const WideString& wsText)
: CFX_XMLNode(), m_wsText(wsText) {}
CFX_XMLText::~CFX_XMLText() {}
diff --git a/core/fxcrt/xml/cfx_xmltext.h b/core/fxcrt/xml/cfx_xmltext.h
index 20fb858302..e9f35855f5 100644
--- a/core/fxcrt/xml/cfx_xmltext.h
+++ b/core/fxcrt/xml/cfx_xmltext.h
@@ -14,18 +14,18 @@
class CFX_XMLText : public CFX_XMLNode {
public:
- explicit CFX_XMLText(const CFX_WideString& wsText);
+ explicit CFX_XMLText(const WideString& wsText);
~CFX_XMLText() override;
// CFX_XMLNode
FX_XMLNODETYPE GetType() const override;
std::unique_ptr<CFX_XMLNode> Clone() override;
- CFX_WideString GetText() const { return m_wsText; }
- void SetText(const CFX_WideString& wsText) { m_wsText = wsText; }
+ WideString GetText() const { return m_wsText; }
+ void SetText(const WideString& wsText) { m_wsText = wsText; }
private:
- CFX_WideString m_wsText;
+ WideString m_wsText;
};
#endif // CORE_FXCRT_XML_CFX_XMLTEXT_H_
diff --git a/core/fxcrt/xml/cxml_attritem.cpp b/core/fxcrt/xml/cxml_attritem.cpp
index 8e55799a62..cbbf3f6041 100644
--- a/core/fxcrt/xml/cxml_attritem.cpp
+++ b/core/fxcrt/xml/cxml_attritem.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/xml/cxml_attritem.h"
-bool CXML_AttrItem::Matches(const CFX_ByteString& space,
- const CFX_ByteString& name) const {
+bool CXML_AttrItem::Matches(const ByteString& space,
+ const ByteString& name) const {
return (space.IsEmpty() || m_QSpaceName == space) && m_AttrName == name;
}
diff --git a/core/fxcrt/xml/cxml_attritem.h b/core/fxcrt/xml/cxml_attritem.h
index 63305e80c8..84d82950f9 100644
--- a/core/fxcrt/xml/cxml_attritem.h
+++ b/core/fxcrt/xml/cxml_attritem.h
@@ -11,11 +11,11 @@
class CXML_AttrItem {
public:
- bool Matches(const CFX_ByteString& space, const CFX_ByteString& name) const;
+ bool Matches(const ByteString& space, const ByteString& name) const;
- CFX_ByteString m_QSpaceName;
- CFX_ByteString m_AttrName;
- CFX_WideString m_Value;
+ ByteString m_QSpaceName;
+ ByteString m_AttrName;
+ WideString m_Value;
};
#endif // CORE_FXCRT_XML_CXML_ATTRITEM_H_
diff --git a/core/fxcrt/xml/cxml_attrmap.cpp b/core/fxcrt/xml/cxml_attrmap.cpp
index 8d226fe5f0..733bbeaa71 100644
--- a/core/fxcrt/xml/cxml_attrmap.cpp
+++ b/core/fxcrt/xml/cxml_attrmap.cpp
@@ -13,8 +13,8 @@ CXML_AttrMap::CXML_AttrMap() {}
CXML_AttrMap::~CXML_AttrMap() {}
-const CFX_WideString* CXML_AttrMap::Lookup(const CFX_ByteString& space,
- const CFX_ByteString& name) const {
+const WideString* CXML_AttrMap::Lookup(const ByteString& space,
+ const ByteString& name) const {
if (!m_pMap)
return nullptr;
@@ -25,9 +25,9 @@ const CFX_WideString* CXML_AttrMap::Lookup(const CFX_ByteString& space,
return nullptr;
}
-void CXML_AttrMap::SetAt(const CFX_ByteString& space,
- const CFX_ByteString& name,
- const CFX_WideString& value) {
+void CXML_AttrMap::SetAt(const ByteString& space,
+ const ByteString& name,
+ const WideString& value) {
if (!m_pMap)
m_pMap = pdfium::MakeUnique<std::vector<CXML_AttrItem>>();
@@ -38,7 +38,7 @@ void CXML_AttrMap::SetAt(const CFX_ByteString& space,
}
}
- m_pMap->push_back({space, name, CFX_WideString(value)});
+ m_pMap->push_back({space, name, WideString(value)});
}
int CXML_AttrMap::GetSize() const {
diff --git a/core/fxcrt/xml/cxml_attrmap.h b/core/fxcrt/xml/cxml_attrmap.h
index 0a026d31d7..a09522b53c 100644
--- a/core/fxcrt/xml/cxml_attrmap.h
+++ b/core/fxcrt/xml/cxml_attrmap.h
@@ -18,14 +18,14 @@ class CXML_AttrMap {
CXML_AttrMap();
~CXML_AttrMap();
- const CFX_WideString* Lookup(const CFX_ByteString& space,
- const CFX_ByteString& name) const;
+ const WideString* Lookup(const ByteString& space,
+ const ByteString& name) const;
int GetSize() const;
CXML_AttrItem& GetAt(int index) const;
- void SetAt(const CFX_ByteString& space,
- const CFX_ByteString& name,
- const CFX_WideString& value);
+ void SetAt(const ByteString& space,
+ const ByteString& name,
+ const WideString& value);
std::unique_ptr<std::vector<CXML_AttrItem>> m_pMap;
};
diff --git a/core/fxcrt/xml/cxml_content.cpp b/core/fxcrt/xml/cxml_content.cpp
index fe0c185bb7..a235009424 100644
--- a/core/fxcrt/xml/cxml_content.cpp
+++ b/core/fxcrt/xml/cxml_content.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/xml/cxml_content.h"
-CXML_Content::CXML_Content(bool bCDATA, const CFX_WideStringC& content)
+CXML_Content::CXML_Content(bool bCDATA, const WideStringView& content)
: m_bCDATA(bCDATA), m_Content(content) {}
CXML_Content::~CXML_Content() {}
diff --git a/core/fxcrt/xml/cxml_content.h b/core/fxcrt/xml/cxml_content.h
index 641efe6720..97c1abfe1c 100644
--- a/core/fxcrt/xml/cxml_content.h
+++ b/core/fxcrt/xml/cxml_content.h
@@ -12,7 +12,7 @@
class CXML_Content : public CXML_Object {
public:
- CXML_Content(bool bCDATA, const CFX_WideStringC& content);
+ CXML_Content(bool bCDATA, const WideStringView& content);
~CXML_Content() override;
// CXML_Object:
@@ -20,7 +20,7 @@ class CXML_Content : public CXML_Object {
const CXML_Content* AsContent() const override;
bool m_bCDATA;
- CFX_WideString m_Content;
+ WideString m_Content;
};
#endif // CORE_FXCRT_XML_CXML_CONTENT_H_
diff --git a/core/fxcrt/xml/cxml_element.cpp b/core/fxcrt/xml/cxml_element.cpp
index ec0a73b00d..42cbdec311 100644
--- a/core/fxcrt/xml/cxml_element.cpp
+++ b/core/fxcrt/xml/cxml_element.cpp
@@ -19,8 +19,8 @@ std::unique_ptr<CXML_Element> CXML_Element::Parse(const void* pBuffer,
}
CXML_Element::CXML_Element(const CXML_Element* pParent,
- const CFX_ByteStringC& qSpace,
- const CFX_ByteStringC& tagname)
+ const ByteStringView& qSpace,
+ const ByteStringView& tagname)
: m_pParent(pParent), m_QSpaceName(qSpace), m_TagName(tagname) {}
CXML_Element::~CXML_Element() {}
@@ -33,23 +33,22 @@ const CXML_Element* CXML_Element::AsElement() const {
return this;
}
-CFX_ByteString CXML_Element::GetTagName(bool bQualified) const {
+ByteString CXML_Element::GetTagName(bool bQualified) const {
if (!bQualified || m_QSpaceName.IsEmpty()) {
return m_TagName;
}
- CFX_ByteString bsTag = m_QSpaceName;
+ ByteString bsTag = m_QSpaceName;
bsTag += ":";
bsTag += m_TagName;
return bsTag;
}
-CFX_ByteString CXML_Element::GetNamespace(bool bQualified) const {
+ByteString CXML_Element::GetNamespace(bool bQualified) const {
return bQualified ? m_QSpaceName : GetNamespaceURI(m_QSpaceName);
}
-CFX_ByteString CXML_Element::GetNamespaceURI(
- const CFX_ByteString& qName) const {
- const CFX_WideString* pwsSpace;
+ByteString CXML_Element::GetNamespaceURI(const ByteString& qName) const {
+ const WideString* pwsSpace;
const CXML_Element* pElement = this;
do {
if (qName.IsEmpty())
@@ -61,13 +60,13 @@ CFX_ByteString CXML_Element::GetNamespaceURI(
pElement = pElement->GetParent();
} while (pElement);
- return pwsSpace ? pwsSpace->UTF8Encode() : CFX_ByteString();
+ return pwsSpace ? pwsSpace->UTF8Encode() : ByteString();
}
void CXML_Element::GetAttrByIndex(int index,
- CFX_ByteString* space,
- CFX_ByteString* name,
- CFX_WideString* value) const {
+ ByteString* space,
+ ByteString* name,
+ WideString* value) const {
if (index < 0 || index >= m_AttrMap.GetSize())
return;
@@ -77,26 +76,26 @@ void CXML_Element::GetAttrByIndex(int index,
*value = item.m_Value;
}
-bool CXML_Element::HasAttr(const CFX_ByteStringC& name) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+bool CXML_Element::HasAttr(const ByteStringView& name) const {
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
- return !!m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
+ return !!m_AttrMap.Lookup(ByteString(bsSpace), ByteString(bsName));
}
-bool CXML_Element::GetAttrValue(const CFX_ByteStringC& name,
- CFX_WideString& attribute) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+bool CXML_Element::GetAttrValue(const ByteStringView& name,
+ WideString& attribute) const {
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
return GetAttrValue(bsSpace, bsName, attribute);
}
-bool CXML_Element::GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- CFX_WideString& attribute) const {
- const CFX_WideString* pValue =
- m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
+bool CXML_Element::GetAttrValue(const ByteStringView& space,
+ const ByteStringView& name,
+ WideString& attribute) const {
+ const WideString* pValue =
+ m_AttrMap.Lookup(ByteString(space), ByteString(name));
if (!pValue)
return false;
@@ -104,13 +103,13 @@ bool CXML_Element::GetAttrValue(const CFX_ByteStringC& space,
return true;
}
-bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& name,
+bool CXML_Element::GetAttrInteger(const ByteStringView& name,
int& attribute) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
- const CFX_WideString* pwsValue =
- m_AttrMap.Lookup(CFX_ByteString(bsSpace), CFX_ByteString(bsName));
+ const WideString* pwsValue =
+ m_AttrMap.Lookup(ByteString(bsSpace), ByteString(bsName));
if (!pwsValue)
return false;
@@ -118,11 +117,11 @@ bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& name,
return true;
}
-bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
+bool CXML_Element::GetAttrInteger(const ByteStringView& space,
+ const ByteStringView& name,
int& attribute) const {
- const CFX_WideString* pwsValue =
- m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
+ const WideString* pwsValue =
+ m_AttrMap.Lookup(ByteString(space), ByteString(name));
if (!pwsValue)
return false;
@@ -130,19 +129,19 @@ bool CXML_Element::GetAttrInteger(const CFX_ByteStringC& space,
return true;
}
-bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& name,
+bool CXML_Element::GetAttrFloat(const ByteStringView& name,
float& attribute) const {
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(name, bsSpace, bsName);
return GetAttrFloat(bsSpace, bsName, attribute);
}
-bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
+bool CXML_Element::GetAttrFloat(const ByteStringView& space,
+ const ByteStringView& name,
float& attribute) const {
- const CFX_WideString* pValue =
- m_AttrMap.Lookup(CFX_ByteString(space), CFX_ByteString(name));
+ const WideString* pValue =
+ m_AttrMap.Lookup(ByteString(space), ByteString(name));
if (!pValue)
return false;
@@ -150,8 +149,8 @@ bool CXML_Element::GetAttrFloat(const CFX_ByteStringC& space,
return true;
}
-uint32_t CXML_Element::CountElements(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag) const {
+uint32_t CXML_Element::CountElements(const ByteStringView& space,
+ const ByteStringView& tag) const {
int count = 0;
for (const auto& pChild : m_Children) {
const CXML_Element* pKid = pChild->AsElement();
@@ -167,8 +166,8 @@ CXML_Object* CXML_Element::GetChild(uint32_t index) const {
return index < m_Children.size() ? m_Children[index].get() : nullptr;
}
-CXML_Element* CXML_Element::GetElement(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag,
+CXML_Element* CXML_Element::GetElement(const ByteStringView& space,
+ const ByteStringView& tag,
int nth) const {
if (nth < 0)
return nullptr;
@@ -196,10 +195,10 @@ uint32_t CXML_Element::FindElement(CXML_Element* pElement) const {
return 0xFFFFFFFF;
}
-void CXML_Element::SetTag(const CFX_ByteStringC& qTagName) {
+void CXML_Element::SetTag(const ByteStringView& qTagName) {
ASSERT(!qTagName.IsEmpty());
- CFX_ByteStringC bsSpace;
- CFX_ByteStringC bsName;
+ ByteStringView bsSpace;
+ ByteStringView bsName;
FX_XML_SplitQualifiedName(qTagName, bsSpace, bsName);
m_QSpaceName = bsSpace;
m_TagName = bsName;
diff --git a/core/fxcrt/xml/cxml_element.h b/core/fxcrt/xml/cxml_element.h
index a4b4b14129..91ac731021 100644
--- a/core/fxcrt/xml/cxml_element.h
+++ b/core/fxcrt/xml/cxml_element.h
@@ -18,85 +18,84 @@ class CXML_Element : public CXML_Object {
static std::unique_ptr<CXML_Element> Parse(const void* pBuffer, size_t size);
CXML_Element(const CXML_Element* pParent,
- const CFX_ByteStringC& qSpace,
- const CFX_ByteStringC& tagname);
+ const ByteStringView& qSpace,
+ const ByteStringView& tagname);
~CXML_Element() override;
// CXML_Object:
CXML_Element* AsElement() override;
const CXML_Element* AsElement() const override;
- CFX_ByteString GetTagName(bool bQualified = false) const;
- CFX_ByteString GetNamespace(bool bQualified = false) const;
- CFX_ByteString GetNamespaceURI(const CFX_ByteString& qName) const;
+ ByteString GetTagName(bool bQualified = false) const;
+ ByteString GetNamespace(bool bQualified = false) const;
+ ByteString GetNamespaceURI(const ByteString& qName) const;
const CXML_Element* GetParent() const { return m_pParent.Get(); }
uint32_t CountAttrs() const { return m_AttrMap.GetSize(); }
void GetAttrByIndex(int index,
- CFX_ByteString* space,
- CFX_ByteString* name,
- CFX_WideString* value) const;
- bool HasAttr(const CFX_ByteStringC& qName) const;
- bool GetAttrValue(const CFX_ByteStringC& name,
- CFX_WideString& attribute) const;
- CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const {
- CFX_WideString attr;
+ ByteString* space,
+ ByteString* name,
+ WideString* value) const;
+ bool HasAttr(const ByteStringView& qName) const;
+ bool GetAttrValue(const ByteStringView& name, WideString& attribute) const;
+ WideString GetAttrValue(const ByteStringView& name) const {
+ WideString attr;
GetAttrValue(name, attr);
return attr;
}
- bool GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
- CFX_WideString& attribute) const;
- CFX_WideString GetAttrValue(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name) const {
- CFX_WideString attr;
+ bool GetAttrValue(const ByteStringView& space,
+ const ByteStringView& name,
+ WideString& attribute) const;
+ WideString GetAttrValue(const ByteStringView& space,
+ const ByteStringView& name) const {
+ WideString attr;
GetAttrValue(space, name, attr);
return attr;
}
- bool GetAttrInteger(const CFX_ByteStringC& name, int& attribute) const;
- int GetAttrInteger(const CFX_ByteStringC& name) const {
+ bool GetAttrInteger(const ByteStringView& name, int& attribute) const;
+ int GetAttrInteger(const ByteStringView& name) const {
int attr = 0;
GetAttrInteger(name, attr);
return attr;
}
- bool GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
+ bool GetAttrInteger(const ByteStringView& space,
+ const ByteStringView& name,
int& attribute) const;
- int GetAttrInteger(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name) const {
+ int GetAttrInteger(const ByteStringView& space,
+ const ByteStringView& name) const {
int attr = 0;
GetAttrInteger(space, name, attr);
return attr;
}
- bool GetAttrFloat(const CFX_ByteStringC& name, float& attribute) const;
- float GetAttrFloat(const CFX_ByteStringC& name) const {
+ bool GetAttrFloat(const ByteStringView& name, float& attribute) const;
+ float GetAttrFloat(const ByteStringView& name) const {
float attr = 0;
GetAttrFloat(name, attr);
return attr;
}
- bool GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name,
+ bool GetAttrFloat(const ByteStringView& space,
+ const ByteStringView& name,
float& attribute) const;
- float GetAttrFloat(const CFX_ByteStringC& space,
- const CFX_ByteStringC& name) const {
+ float GetAttrFloat(const ByteStringView& space,
+ const ByteStringView& name) const {
float attr = 0;
GetAttrFloat(space, name, attr);
return attr;
}
uint32_t CountChildren() const { return m_Children.size(); }
- uint32_t CountElements(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag) const;
+ uint32_t CountElements(const ByteStringView& space,
+ const ByteStringView& tag) const;
CXML_Object* GetChild(uint32_t index) const;
- CXML_Element* GetElement(const CFX_ByteStringC& space,
- const CFX_ByteStringC& tag,
+ CXML_Element* GetElement(const ByteStringView& space,
+ const ByteStringView& tag,
int nth) const;
uint32_t FindElement(CXML_Element* pElement) const;
- void SetTag(const CFX_ByteStringC& qTagName);
+ void SetTag(const ByteStringView& qTagName);
void RemoveChild(uint32_t index);
private:
@@ -104,8 +103,8 @@ class CXML_Element : public CXML_Object {
friend class CXML_Composer;
CFX_UnownedPtr<const CXML_Element> const m_pParent;
- CFX_ByteString m_QSpaceName;
- CFX_ByteString m_TagName;
+ ByteString m_QSpaceName;
+ ByteString m_TagName;
CXML_AttrMap m_AttrMap;
std::vector<std::unique_ptr<CXML_Object>> m_Children;
};
diff --git a/core/fxcrt/xml/cxml_parser.cpp b/core/fxcrt/xml/cxml_parser.cpp
index 9679e2cd41..adf83c7148 100644
--- a/core/fxcrt/xml/cxml_parser.cpp
+++ b/core/fxcrt/xml/cxml_parser.cpp
@@ -78,9 +78,9 @@ bool g_FXCRT_XML_IsNameChar(uint8_t ch) {
} // namespace
-void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
- CFX_ByteStringC& bsSpace,
- CFX_ByteStringC& bsName) {
+void FX_XML_SplitQualifiedName(const ByteStringView& bsFullName,
+ ByteStringView& bsSpace,
+ ByteStringView& bsName) {
if (bsFullName.IsEmpty())
return;
@@ -139,7 +139,7 @@ void CXML_Parser::SkipWhiteSpaces() {
} while (ReadNextBlock());
}
-void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) {
+void CXML_Parser::GetName(ByteString* space, ByteString* name) {
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
if (IsEOF())
return;
@@ -149,7 +149,7 @@ void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) {
while (m_dwIndex < m_dwBufferSize) {
uint8_t ch = m_pBuffer[m_dwIndex];
if (ch == ':') {
- *space = CFX_ByteString(buf);
+ *space = ByteString(buf);
buf.str("");
} else if (g_FXCRT_XML_IsNameChar(ch)) {
buf << static_cast<char>(ch);
@@ -162,10 +162,10 @@ void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) {
if (m_dwIndex < m_dwBufferSize || IsEOF())
break;
} while (ReadNextBlock());
- *name = CFX_ByteString(buf);
+ *name = ByteString(buf);
}
-void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) {
+void CXML_Parser::SkipLiterals(const ByteStringView& str) {
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
if (IsEOF()) {
return;
@@ -281,7 +281,7 @@ uint32_t CXML_Parser::GetCharRef() {
return code;
}
-void CXML_Parser::GetAttrValue(CFX_WideString& value) {
+void CXML_Parser::GetAttrValue(WideString& value) {
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
if (IsEOF())
return;
@@ -323,8 +323,8 @@ void CXML_Parser::GetAttrValue(CFX_WideString& value) {
void CXML_Parser::GetTagName(bool bStartTag,
bool* bEndTag,
- CFX_ByteString* space,
- CFX_ByteString* name) {
+ ByteString* space,
+ ByteString* name) {
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
if (IsEOF())
return;
@@ -389,18 +389,18 @@ std::unique_ptr<CXML_Element> CXML_Parser::ParseElementInternal(
if (IsEOF())
return nullptr;
- CFX_ByteString tag_name;
- CFX_ByteString tag_space;
+ ByteString tag_name;
+ ByteString tag_space;
bool bEndTag;
GetTagName(bStartTag, &bEndTag, &tag_space, &tag_name);
if (tag_name.IsEmpty() || bEndTag)
return nullptr;
auto pElement = pdfium::MakeUnique<CXML_Element>(
- pParent, tag_space.AsStringC(), tag_name.AsStringC());
+ pParent, tag_space.AsStringView(), tag_name.AsStringView());
do {
- CFX_ByteString attr_space;
- CFX_ByteString attr_name;
+ ByteString attr_space;
+ ByteString attr_name;
while (m_dwIndex < m_dwBufferSize) {
SkipWhiteSpaces();
if (IsEOF())
@@ -422,7 +422,7 @@ std::unique_ptr<CXML_Element> CXML_Parser::ParseElementInternal(
if (IsEOF())
break;
- CFX_WideString attr_value;
+ WideString attr_value;
GetAttrValue(attr_value);
pElement->m_AttrMap.SetAt(attr_space, attr_name, attr_value);
}
@@ -474,19 +474,20 @@ std::unique_ptr<CXML_Element> CXML_Parser::ParseElementInternal(
SkipWhiteSpaces();
iState = 0;
} else if (ch == '/') {
- CFX_ByteString space;
- CFX_ByteString name;
+ ByteString space;
+ ByteString name;
GetName(&space, &name);
SkipWhiteSpaces();
m_dwIndex++;
iState = 10;
} else {
content << decoder.GetResult();
- CFX_WideString dataStr = content.MakeString();
+ WideString dataStr = content.MakeString();
if (!bCDATA)
dataStr.TrimRight(L" \t\r\n");
- InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get());
+ InsertContentSegment(bCDATA, dataStr.AsStringView(),
+ pElement.get());
content.Clear();
decoder.Clear();
bCDATA = false;
@@ -524,10 +525,10 @@ std::unique_ptr<CXML_Element> CXML_Parser::ParseElementInternal(
break;
} while (ReadNextBlock());
content << decoder.GetResult();
- CFX_WideString dataStr = content.MakeString();
+ WideString dataStr = content.MakeString();
dataStr.TrimRight(L" \t\r\n");
- InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement.get());
+ InsertContentSegment(bCDATA, dataStr.AsStringView(), pElement.get());
content.Clear();
decoder.Clear();
bCDATA = false;
@@ -535,7 +536,7 @@ std::unique_ptr<CXML_Element> CXML_Parser::ParseElementInternal(
}
void CXML_Parser::InsertContentSegment(bool bCDATA,
- const CFX_WideStringC& content,
+ const WideStringView& content,
CXML_Element* pElement) {
if (content.IsEmpty())
return;
diff --git a/core/fxcrt/xml/cxml_parser.h b/core/fxcrt/xml/cxml_parser.h
index 33bd711ee1..ee5a1b6e18 100644
--- a/core/fxcrt/xml/cxml_parser.h
+++ b/core/fxcrt/xml/cxml_parser.h
@@ -26,18 +26,18 @@ class CXML_Parser {
bool IsEOF();
bool HaveAvailData();
void SkipWhiteSpaces();
- void GetName(CFX_ByteString* space, CFX_ByteString* name);
- void GetAttrValue(CFX_WideString& value);
+ void GetName(ByteString* space, ByteString* name);
+ void GetAttrValue(WideString& value);
uint32_t GetCharRef();
void GetTagName(bool bStartTag,
bool* bEndTag,
- CFX_ByteString* space,
- CFX_ByteString* name);
- void SkipLiterals(const CFX_ByteStringC& str);
+ ByteString* space,
+ ByteString* name);
+ void SkipLiterals(const ByteStringView& str);
std::unique_ptr<CXML_Element> ParseElement(CXML_Element* pParent,
bool bStartTag);
void InsertContentSegment(bool bCDATA,
- const CFX_WideStringC& content,
+ const WideStringView& content,
CXML_Element* pElement);
void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement);
@@ -54,8 +54,8 @@ class CXML_Parser {
size_t m_dwIndex;
};
-void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName,
- CFX_ByteStringC& bsSpace,
- CFX_ByteStringC& bsName);
+void FX_XML_SplitQualifiedName(const ByteStringView& bsFullName,
+ ByteStringView& bsSpace,
+ ByteStringView& bsName);
#endif // CORE_FXCRT_XML_CXML_PARSER_H_
diff --git a/core/fxge/android/cfpf_skiafont.cpp b/core/fxge/android/cfpf_skiafont.cpp
index e00aa840e4..1ca0f576be 100644
--- a/core/fxge/android/cfpf_skiafont.cpp
+++ b/core/fxge/android/cfpf_skiafont.cpp
@@ -41,15 +41,15 @@ CFPF_SkiaFont* CFPF_SkiaFont::Retain() {
return this;
}
-CFX_ByteString CFPF_SkiaFont::GetFamilyName() {
+ByteString CFPF_SkiaFont::GetFamilyName() {
if (!m_Face)
- return CFX_ByteString();
- return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
+ return ByteString();
+ return ByteString(FXFT_Get_Face_Family_Name(m_Face));
}
-CFX_ByteString CFPF_SkiaFont::GetPsName() {
+ByteString CFPF_SkiaFont::GetPsName() {
if (!m_Face)
- return CFX_ByteString();
+ return ByteString();
return FXFT_Get_Postscript_Name(m_Face);
}
@@ -181,7 +181,7 @@ uint32_t CFPF_SkiaFont::GetFontData(uint32_t dwTable,
bool CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr,
CFPF_SkiaFontDescriptor* pFontDes,
- const CFX_ByteStringC& bsFamily,
+ const ByteStringView& bsFamily,
uint32_t dwStyle,
uint8_t uCharset) {
if (!pFontMgr || !pFontDes)
diff --git a/core/fxge/android/cfpf_skiafont.h b/core/fxge/android/cfpf_skiafont.h
index 5686e9e31f..c842d5abb9 100644
--- a/core/fxge/android/cfpf_skiafont.h
+++ b/core/fxge/android/cfpf_skiafont.h
@@ -22,8 +22,8 @@ class CFPF_SkiaFont {
void Release();
CFPF_SkiaFont* Retain();
- CFX_ByteString GetFamilyName();
- CFX_ByteString GetPsName();
+ ByteString GetFamilyName();
+ ByteString GetPsName();
uint32_t GetFontStyle() const { return m_dwStyle; }
uint8_t GetCharset() const { return m_uCharset; }
int32_t GetGlyphIndex(wchar_t wUnicode);
@@ -38,7 +38,7 @@ class CFPF_SkiaFont {
bool InitFont(CFPF_SkiaFontMgr* pFontMgr,
CFPF_SkiaFontDescriptor* pFontDes,
- const CFX_ByteStringC& bsFamily,
+ const ByteStringView& bsFamily,
uint32_t dwStyle,
uint8_t uCharset);
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 16a6df5f8f..a50b9ead63 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -158,7 +158,7 @@ uint32_t FPF_SkiaGetCharset(uint8_t uCharset) {
return FPF_SKIACHARSET_Default;
}
-uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) {
+uint32_t FPF_SKIANormalizeFontName(const ByteStringView& bsfamily) {
uint32_t dwHash = 0;
int32_t iLength = bsfamily.GetLength();
const char* pBuffer = bsfamily.unterminated_c_str();
@@ -171,10 +171,10 @@ uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) {
return dwHash;
}
-uint32_t FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily,
+uint32_t FPF_SKIAGetFamilyHash(const ByteStringView& bsFamily,
uint32_t dwStyle,
uint8_t uCharset) {
- CFX_ByteString bsFont(bsFamily);
+ ByteString bsFont(bsFamily);
if (dwStyle & FXFONT_BOLD)
bsFont += "Bold";
if (dwStyle & FXFONT_ITALIC)
@@ -191,14 +191,14 @@ bool FPF_SkiaIsCJK(uint8_t uCharset) {
(uCharset == FX_CHARSET_Hangul) || (uCharset == FX_CHARSET_ShiftJIS);
}
-bool FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) {
- CFX_ByteString bsName(bsFacename);
+bool FPF_SkiaMaybeSymbol(const ByteStringView& bsFacename) {
+ ByteString bsName(bsFacename);
bsName.MakeLower();
return bsName.Contains("symbol");
}
-bool FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) {
- CFX_ByteString bsName(bsFacename);
+bool FPF_SkiaMaybeArabic(const ByteStringView& bsFacename) {
+ ByteString bsName(bsFacename);
bsName.MakeLower();
return bsName.Contains("arabic");
}
@@ -280,7 +280,7 @@ void CFPF_SkiaFontMgr::LoadSystemFonts() {
m_bLoaded = true;
}
-CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
+CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const ByteStringView& bsFamilyname,
uint8_t uCharset,
uint32_t dwStyle,
uint32_t dwMatch) {
@@ -387,7 +387,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(
return face;
}
-FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile,
+FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const ByteStringView& bsFile,
int32_t iFaceIndex) {
if (bsFile.IsEmpty())
return nullptr;
@@ -421,23 +421,23 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer,
return face;
}
-void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteString& path) {
+void CFPF_SkiaFontMgr::ScanPath(const ByteString& path) {
DIR* handle = FX_OpenFolder(path.c_str());
if (!handle)
return;
- CFX_ByteString filename;
+ ByteString filename;
bool bFolder = false;
while (FX_GetNextFile(handle, &filename, &bFolder)) {
if (bFolder) {
if (filename == "." || filename == "..")
continue;
} else {
- CFX_ByteString ext = filename.Right(4);
+ ByteString ext = filename.Right(4);
ext.MakeLower();
if (ext != ".ttf" && ext != ".ttc" && ext != ".otf")
continue;
}
- CFX_ByteString fullpath(path);
+ ByteString fullpath(path);
fullpath += "/";
fullpath += filename;
if (bFolder)
@@ -448,8 +448,8 @@ void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteString& path) {
FX_CloseFolder(handle);
}
-void CFPF_SkiaFontMgr::ScanFile(const CFX_ByteString& file) {
- FXFT_Face face = GetFontFace(file.AsStringC());
+void CFPF_SkiaFontMgr::ScanFile(const ByteString& file) {
+ FXFT_Face face = GetFontFace(file.AsStringView());
if (!face)
return;
CFPF_SkiaPathFont* pFontDesc = new CFPF_SkiaPathFont;
diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h
index 4d0ea0e0d2..78d01717b9 100644
--- a/core/fxge/android/cfpf_skiafontmgr.h
+++ b/core/fxge/android/cfpf_skiafontmgr.h
@@ -25,7 +25,7 @@ class CFPF_SkiaFontMgr {
~CFPF_SkiaFontMgr();
void LoadSystemFonts();
- CFPF_SkiaFont* CreateFont(const CFX_ByteStringC& bsFamilyname,
+ CFPF_SkiaFont* CreateFont(const ByteStringView& bsFamilyname,
uint8_t uCharset,
uint32_t dwStyle,
uint32_t dwMatch = 0);
@@ -33,14 +33,14 @@ class CFPF_SkiaFontMgr {
bool InitFTLibrary();
FXFT_Face GetFontFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead,
int32_t iFaceIndex = 0);
- FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0);
+ FXFT_Face GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex = 0);
FXFT_Face GetFontFace(const uint8_t* pBuffer,
size_t szBuffer,
int32_t iFaceIndex = 0);
private:
- void ScanPath(const CFX_ByteString& path);
- void ScanFile(const CFX_ByteString& file);
+ void ScanPath(const ByteString& path);
+ void ScanFile(const ByteString& file);
void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc);
bool m_bLoaded;
diff --git a/core/fxge/android/cfx_androidfontinfo.cpp b/core/fxge/android/cfx_androidfontinfo.cpp
index 1183cdeaaa..c6c3e61866 100644
--- a/core/fxge/android/cfx_androidfontinfo.cpp
+++ b/core/fxge/android/cfx_androidfontinfo.cpp
@@ -63,7 +63,7 @@ uint32_t CFX_AndroidFontInfo::GetFontData(void* hFont,
return static_cast<CFPF_SkiaFont*>(hFont)->GetFontData(table, buffer, size);
}
-bool CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
+bool CFX_AndroidFontInfo::GetFaceName(void* hFont, ByteString* name) {
if (!hFont)
return false;
diff --git a/core/fxge/android/cfx_androidfontinfo.h b/core/fxge/android/cfx_androidfontinfo.h
index 17bbf89a3e..3fde349fb3 100644
--- a/core/fxge/android/cfx_androidfontinfo.h
+++ b/core/fxge/android/cfx_androidfontinfo.h
@@ -35,7 +35,7 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo {
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFaceName(void* hFont, ByteString* name) override;
bool GetFontCharset(void* hFont, int* charset) override;
void DeleteFont(void* hFont) override;
diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp
index 2eee8e2e62..637984797a 100644
--- a/core/fxge/apple/fx_mac_imp.cpp
+++ b/core/fxge/apple/fx_mac_imp.cpp
@@ -51,7 +51,7 @@ class CFX_MacFontInfo : public CFX_FolderFontInfo {
const char JAPAN_GOTHIC[] = "Hiragino Kaku Gothic Pro W6";
const char JAPAN_MINCHO[] = "Hiragino Mincho Pro W6";
-void GetJapanesePreference(CFX_ByteString* face, int weight, int pitch_family) {
+void GetJapanesePreference(ByteString* face, int weight, int pitch_family) {
if (face->Contains("Gothic")) {
*face = JAPAN_GOTHIC;
return;
@@ -66,9 +66,9 @@ void* CFX_MacFontInfo::MapFont(int weight,
int pitch_family,
const char* cstr_face,
int& iExact) {
- CFX_ByteString face = cstr_face;
+ ByteString face = cstr_face;
for (size_t i = 0; i < FX_ArraySize(g_Base14Substs); ++i) {
- if (face == CFX_ByteStringC(g_Base14Substs[i].m_pName)) {
+ if (face == ByteStringView(g_Base14Substs[i].m_pName)) {
face = g_Base14Substs[i].m_pSubstName;
iExact = true;
return GetFont(face.c_str());
@@ -83,7 +83,7 @@ void* CFX_MacFontInfo::MapFont(int weight,
// fonts in |m_FontList| with |face| in the name, and examine the fonts to
// see which best matches the requested characteristics.
if (!face.Contains("Bold") && !face.Contains("Italic")) {
- CFX_ByteString new_face = face;
+ ByteString new_face = face;
if (weight > 400)
new_face += " Bold";
if (bItalic)
diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp
index eac28074fc..74b38ef61d 100644
--- a/core/fxge/cfx_facecache.cpp
+++ b/core/fxge/cfx_facecache.cpp
@@ -299,7 +299,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont,
}
}
#endif
- CFX_ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
+ ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ || defined _SKIA_SUPPORT_ || \
defined _SKIA_SUPPORT_PATHS_
return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index,
@@ -344,7 +344,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont,
keygen.Generate(6, nMatrixA, nMatrixB, nMatrixC, nMatrixD, dest_width,
anti_alias);
}
- CFX_ByteString FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen);
+ ByteString FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen);
text_flags |= FXTEXT_NO_NATIVETEXT;
return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index,
bFontStyle, dest_width, anti_alias);
@@ -375,7 +375,7 @@ void CFX_FaceCache::InitPlatform() {}
CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(
const CFX_Font* pFont,
const CFX_Matrix* pMatrix,
- const CFX_ByteString& FaceGlyphsKey,
+ const ByteString& FaceGlyphsKey,
uint32_t glyph_index,
bool bFontStyle,
int dest_width,
diff --git a/core/fxge/cfx_facecache.h b/core/fxge/cfx_facecache.h
index 076ba1f330..58b08edde5 100644
--- a/core/fxge/cfx_facecache.h
+++ b/core/fxge/cfx_facecache.h
@@ -52,7 +52,7 @@ class CFX_FaceCache {
int anti_alias);
CFX_GlyphBitmap* LookUpGlyphBitmap(const CFX_Font* pFont,
const CFX_Matrix* pMatrix,
- const CFX_ByteString& FaceGlyphsKey,
+ const ByteString& FaceGlyphsKey,
uint32_t glyph_index,
bool bFontStyle,
int dest_width,
@@ -61,7 +61,7 @@ class CFX_FaceCache {
void DestroyPlatform();
FXFT_Face const m_Face;
- std::map<CFX_ByteString, std::unique_ptr<CFX_SizeGlyphCache>> m_SizeMap;
+ std::map<ByteString, std::unique_ptr<CFX_SizeGlyphCache>> m_SizeMap;
std::map<uint32_t, std::unique_ptr<CFX_PathData>> m_PathMap;
#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
sk_sp<SkTypeface> m_pTypeface;
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index f4f57e4b05..0dc61c998f 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -36,18 +36,18 @@ const struct {
{"Times-Italic", "Times New Roman Italic"},
};
-CFX_ByteString FPDF_ReadStringFromFile(FILE* pFile, uint32_t size) {
- CFX_ByteString buffer;
+ByteString FPDF_ReadStringFromFile(FILE* pFile, uint32_t size) {
+ ByteString buffer;
if (!fread(buffer.GetBuffer(size), size, 1, pFile))
- return CFX_ByteString();
+ return ByteString();
buffer.ReleaseBuffer(size);
return buffer;
}
-CFX_ByteString FPDF_LoadTableFromTT(FILE* pFile,
- const uint8_t* pTables,
- uint32_t nTables,
- uint32_t tag) {
+ByteString FPDF_LoadTableFromTT(FILE* pFile,
+ const uint8_t* pTables,
+ uint32_t nTables,
+ uint32_t tag) {
for (uint32_t i = 0; i < nTables; i++) {
const uint8_t* p = pTables + i * 16;
if (GET_TT_LONG(p) == tag) {
@@ -57,7 +57,7 @@ CFX_ByteString FPDF_LoadTableFromTT(FILE* pFile,
return FPDF_ReadStringFromFile(pFile, size);
}
}
- return CFX_ByteString();
+ return ByteString();
}
uint32_t GetCharset(int charset) {
@@ -106,7 +106,7 @@ CFX_FolderFontInfo::CFX_FolderFontInfo() {}
CFX_FolderFontInfo::~CFX_FolderFontInfo() {}
-void CFX_FolderFontInfo::AddPath(const CFX_ByteString& path) {
+void CFX_FolderFontInfo::AddPath(const ByteString& path) {
m_PathList.push_back(path);
}
@@ -117,25 +117,25 @@ bool CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
return true;
}
-void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) {
+void CFX_FolderFontInfo::ScanPath(const ByteString& path) {
FX_FileHandle* handle = FX_OpenFolder(path.c_str());
if (!handle)
return;
- CFX_ByteString filename;
+ ByteString filename;
bool bFolder;
while (FX_GetNextFile(handle, &filename, &bFolder)) {
if (bFolder) {
if (filename == "." || filename == "..")
continue;
} else {
- CFX_ByteString ext = filename.Right(4);
+ ByteString ext = filename.Right(4);
ext.MakeUpper();
if (ext != ".TTF" && ext != ".OTF" && ext != ".TTC")
continue;
}
- CFX_ByteString fullpath = path;
+ ByteString fullpath = path;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
fullpath += "\\";
#else
@@ -148,7 +148,7 @@ void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) {
FX_CloseFolder(handle);
}
-void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) {
+void CFX_FolderFontInfo::ScanFile(const ByteString& path) {
FILE* pFile = fopen(path.c_str(), "rb");
if (!pFile)
return;
@@ -190,7 +190,7 @@ void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) {
fclose(pFile);
}
-void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
+void CFX_FolderFontInfo::ReportFace(const ByteString& path,
FILE* pFile,
uint32_t filesize,
uint32_t offset) {
@@ -200,21 +200,20 @@ void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
return;
uint32_t nTables = GET_TT_SHORT(buffer + 4);
- CFX_ByteString tables = FPDF_ReadStringFromFile(pFile, nTables * 16);
+ ByteString tables = FPDF_ReadStringFromFile(pFile, nTables * 16);
if (tables.IsEmpty())
return;
- CFX_ByteString names =
+ ByteString names =
FPDF_LoadTableFromTT(pFile, tables.raw_str(), nTables, 0x6e616d65);
if (names.IsEmpty())
return;
- CFX_ByteString facename =
- GetNameFromTT(names.raw_str(), names.GetLength(), 1);
+ ByteString facename = GetNameFromTT(names.raw_str(), names.GetLength(), 1);
if (facename.IsEmpty())
return;
- CFX_ByteString style = GetNameFromTT(names.raw_str(), names.GetLength(), 2);
+ ByteString style = GetNameFromTT(names.raw_str(), names.GetLength(), 2);
if (style != "Regular")
facename += " " + style;
@@ -223,7 +222,7 @@ void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
auto pInfo = pdfium::MakeUnique<CFX_FontFaceInfo>(path, facename, tables,
offset, filesize);
- CFX_ByteString os2 =
+ ByteString os2 =
FPDF_LoadTableFromTT(pFile, tables.raw_str(), nTables, 0x4f532f32);
if (os2.GetLength() >= 86) {
const uint8_t* p = os2.raw_str() + 78;
@@ -262,7 +261,7 @@ void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
m_FontList[facename] = std::move(pInfo);
}
-void* CFX_FolderFontInfo::GetSubstFont(const CFX_ByteString& face) {
+void* CFX_FolderFontInfo::GetSubstFont(const ByteString& face) {
for (size_t iBaseFont = 0; iBaseFont < FX_ArraySize(Base14Substs);
iBaseFont++) {
if (face == Base14Substs[iBaseFont].m_pName)
@@ -284,7 +283,7 @@ void* CFX_FolderFontInfo::FindFont(int weight,
uint32_t charset_flag = GetCharset(charset);
int32_t iBestSimilar = 0;
for (const auto& it : m_FontList) {
- const CFX_ByteString& bsName = it.first;
+ const ByteString& bsName = it.first;
CFX_FontFaceInfo* pFont = it.second.get();
if (!(pFont->m_Charsets & charset_flag) && charset != FX_CHARSET_Default)
continue;
@@ -367,7 +366,7 @@ uint32_t CFX_FolderFontInfo::GetFontData(void* hFont,
void CFX_FolderFontInfo::DeleteFont(void* hFont) {}
-bool CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
+bool CFX_FolderFontInfo::GetFaceName(void* hFont, ByteString* name) {
if (!hFont)
return false;
*name = static_cast<CFX_FontFaceInfo*>(hFont)->m_FaceName;
diff --git a/core/fxge/cfx_folderfontinfo.h b/core/fxge/cfx_folderfontinfo.h
index 82ed902b22..e7c3f21a9f 100644
--- a/core/fxge/cfx_folderfontinfo.h
+++ b/core/fxge/cfx_folderfontinfo.h
@@ -21,7 +21,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
CFX_FolderFontInfo();
~CFX_FolderFontInfo() override;
- void AddPath(const CFX_ByteString& path);
+ void AddPath(const ByteString& path);
// IFX_SytemFontInfo:
bool EnumFontList(CFX_FontMapper* pMapper) override;
@@ -43,17 +43,17 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
uint8_t* buffer,
uint32_t size) override;
void DeleteFont(void* hFont) override;
- bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFaceName(void* hFont, ByteString* name) override;
bool GetFontCharset(void* hFont, int* charset) override;
protected:
- void ScanPath(const CFX_ByteString& path);
- void ScanFile(const CFX_ByteString& path);
- void ReportFace(const CFX_ByteString& path,
+ void ScanPath(const ByteString& path);
+ void ScanFile(const ByteString& path);
+ void ReportFace(const ByteString& path,
FILE* pFile,
uint32_t filesize,
uint32_t offset);
- void* GetSubstFont(const CFX_ByteString& face);
+ void* GetSubstFont(const ByteString& face);
void* FindFont(int weight,
bool bItalic,
int charset,
@@ -61,8 +61,8 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
const char* family,
bool bMatchName);
- std::map<CFX_ByteString, std::unique_ptr<CFX_FontFaceInfo>> m_FontList;
- std::vector<CFX_ByteString> m_PathList;
+ std::map<ByteString, std::unique_ptr<CFX_FontFaceInfo>> m_FontList;
+ std::vector<ByteString> m_PathList;
CFX_UnownedPtr<CFX_FontMapper> m_pMapper;
};
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 7a51df1b85..017b120dd4 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -291,7 +291,7 @@ void CFX_Font::DeleteFace() {
m_Face = nullptr;
}
-void CFX_Font::LoadSubst(const CFX_ByteString& face_name,
+void CFX_Font::LoadSubst(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -446,7 +446,7 @@ bool CFX_Font::IsItalic() const {
if (FXFT_Is_Face_Italic(m_Face) == FXFT_STYLE_FLAG_ITALIC)
return true;
- CFX_ByteString str(FXFT_Get_Face_Style_Name(m_Face));
+ ByteString str(FXFT_Get_Face_Style_Name(m_Face));
str.MakeLower();
return str.Contains("italic");
}
@@ -459,31 +459,31 @@ bool CFX_Font::IsFixedWidth() const {
return m_Face && FXFT_Is_Face_fixedwidth(m_Face) != 0;
}
-CFX_ByteString CFX_Font::GetPsName() const {
+ByteString CFX_Font::GetPsName() const {
if (!m_Face)
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString psName = FXFT_Get_Postscript_Name(m_Face);
+ ByteString psName = FXFT_Get_Postscript_Name(m_Face);
if (psName.IsEmpty())
psName = "Untitled";
return psName;
}
-CFX_ByteString CFX_Font::GetFamilyName() const {
+ByteString CFX_Font::GetFamilyName() const {
if (!m_Face && !m_pSubstFont)
- return CFX_ByteString();
+ return ByteString();
if (m_Face)
- return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
+ return ByteString(FXFT_Get_Face_Family_Name(m_Face));
return m_pSubstFont->m_Family;
}
-CFX_ByteString CFX_Font::GetFaceName() const {
+ByteString CFX_Font::GetFaceName() const {
if (!m_Face && !m_pSubstFont)
- return CFX_ByteString();
+ return ByteString();
if (m_Face) {
- CFX_ByteString style = CFX_ByteString(FXFT_Get_Face_Style_Name(m_Face));
- CFX_ByteString facename = GetFamilyName();
+ ByteString style = ByteString(FXFT_Get_Face_Style_Name(m_Face));
+ ByteString facename = GetFamilyName();
if (facename.IsEmpty())
facename = "Untitled";
if (!style.IsEmpty() && style != "Regular")
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index bff9fad5c3..4e26c62eeb 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -170,7 +170,7 @@ const struct CODEPAGE_MAP {
};
int CompareFontFamilyString(const void* key, const void* element) {
- CFX_ByteString str_key((const char*)key);
+ ByteString str_key((const char*)key);
const AltFontFamily* family = reinterpret_cast<const AltFontFamily*>(element);
if (str_key.Contains(family->m_pFontName))
return 0;
@@ -182,8 +182,8 @@ int CompareString(const void* key, const void* element) {
reinterpret_cast<const AltFontName*>(element)->m_pName);
}
-CFX_ByteString TT_NormalizeName(const char* family) {
- CFX_ByteString norm(family);
+ByteString TT_NormalizeName(const char* family) {
+ ByteString norm(family);
norm.Remove(' ');
norm.Remove('-');
norm.Remove(',');
@@ -207,7 +207,7 @@ uint8_t GetCharsetFromCodePage(uint16_t codepage) {
return FX_CHARSET_Default;
}
-CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) {
+ByteString GetFontFamily(ByteString fontName, int nStyle) {
if (fontName.Contains("Script")) {
if ((nStyle & FX_FONT_STYLE_Bold) == FX_FONT_STYLE_Bold)
fontName = "ScriptMTBold";
@@ -222,23 +222,23 @@ CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) {
AltFontFamily* found = reinterpret_cast<AltFontFamily*>(bsearch(
fontName.c_str(), g_AltFontFamilies, FX_ArraySize(g_AltFontFamilies),
sizeof(AltFontFamily), CompareFontFamilyString));
- return found ? CFX_ByteString(found->m_pFontFamily) : fontName;
+ return found ? ByteString(found->m_pFontFamily) : fontName;
}
-CFX_ByteString ParseStyle(const char* pStyle, int iLen, int iIndex) {
+ByteString ParseStyle(const char* pStyle, int iLen, int iIndex) {
std::ostringstream buf;
if (!iLen || iLen <= iIndex)
- return CFX_ByteString(buf);
+ return ByteString(buf);
while (iIndex < iLen) {
if (pStyle[iIndex] == ',')
break;
buf << pStyle[iIndex];
++iIndex;
}
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
-int32_t GetStyleType(const CFX_ByteString& bsStyle, bool bReverse) {
+int32_t GetStyleType(const ByteString& bsStyle, bool bReverse) {
int32_t iLen = bsStyle.GetLength();
if (!iLen)
return -1;
@@ -260,7 +260,7 @@ int32_t GetStyleType(const CFX_ByteString& bsStyle, bool bReverse) {
return -1;
}
-bool CheckSupportThirdPartFont(CFX_ByteString name, int& PitchFamily) {
+bool CheckSupportThirdPartFont(ByteString name, int& PitchFamily) {
if (name == "MyriadPro") {
PitchFamily &= ~FXFONT_FF_ROMAN;
return true;
@@ -305,23 +305,23 @@ void CFX_FontMapper::SetSystemFontInfo(
m_pFontInfo = std::move(pFontInfo);
}
-CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) {
+ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) {
if (!m_pFontInfo)
- return CFX_ByteString();
+ return ByteString();
uint32_t size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0);
if (!size)
- return CFX_ByteString();
+ return ByteString();
std::vector<uint8_t> buffer(size);
uint8_t* buffer_ptr = buffer.data();
uint32_t bytes_read =
m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size);
return bytes_read == size ? GetNameFromTT(buffer_ptr, bytes_read, 6)
- : CFX_ByteString();
+ : ByteString();
}
-void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
+void CFX_FontMapper::AddInstalledFont(const ByteString& name, int charset) {
if (!m_pFontInfo)
return;
@@ -343,7 +343,7 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
return;
}
- CFX_ByteString new_name = GetPSNameFromTT(hFont);
+ ByteString new_name = GetPSNameFromTT(hFont);
if (!new_name.IsEmpty())
m_LocalizedTTFonts.push_back(std::make_pair(new_name, name));
m_pFontInfo->DeleteFont(hFont);
@@ -360,22 +360,20 @@ void CFX_FontMapper::LoadInstalledFonts() {
m_bListLoaded = true;
}
-CFX_ByteString CFX_FontMapper::MatchInstalledFonts(
- const CFX_ByteString& norm_name) {
+ByteString CFX_FontMapper::MatchInstalledFonts(const ByteString& norm_name) {
LoadInstalledFonts();
int i;
for (i = pdfium::CollectionSize<int>(m_InstalledTTFonts) - 1; i >= 0; i--) {
- CFX_ByteString norm1 = TT_NormalizeName(m_InstalledTTFonts[i].c_str());
+ ByteString norm1 = TT_NormalizeName(m_InstalledTTFonts[i].c_str());
if (norm1 == norm_name)
return m_InstalledTTFonts[i];
}
for (i = pdfium::CollectionSize<int>(m_LocalizedTTFonts) - 1; i >= 0; i--) {
- CFX_ByteString norm1 =
- TT_NormalizeName(m_LocalizedTTFonts[i].first.c_str());
+ ByteString norm1 = TT_NormalizeName(m_LocalizedTTFonts[i].first.c_str());
if (norm1 == norm_name)
return m_LocalizedTTFonts[i].second;
}
- return CFX_ByteString();
+ return ByteString();
}
FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
@@ -418,7 +416,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
return m_MMFaces[0];
}
-FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
+FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -429,7 +427,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
weight = FXFONT_FW_NORMAL;
italic_angle = 0;
}
- CFX_ByteString SubstName = name;
+ ByteString SubstName = name;
SubstName.Remove(' ');
if (bTrueType && name.GetLength() > 0 && name[0] == '@')
SubstName = name.Right(name.GetLength() - 1);
@@ -445,8 +443,8 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
return UseInternalSubst(pSubstFont, 13, italic_angle, weight, 0);
}
int iBaseFont = 0;
- CFX_ByteString family;
- CFX_ByteString style;
+ ByteString family;
+ ByteString style;
bool bHasComma = false;
bool bHasHyphen = false;
auto pos = SubstName.Find(",", 0);
@@ -459,7 +457,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
family = SubstName;
}
for (; iBaseFont < 12; iBaseFont++) {
- if (family == CFX_ByteStringC(g_Base14FontNames[iBaseFont]))
+ if (family == ByteStringView(g_Base14FontNames[iBaseFont]))
break;
}
int PitchFamily = 0;
@@ -505,7 +503,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
const char* pStyle = style.c_str();
int i = 0;
bool bFirstItem = true;
- CFX_ByteString buf;
+ ByteString buf;
while (i < nLen) {
buf = ParseStyle(pStyle, nLen, i);
int32_t nRet = GetStyleType(buf, false);
@@ -568,7 +566,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
PitchFamily);
}
family = GetFontFamily(family, nStyle);
- CFX_ByteString match = MatchInstalledFonts(TT_NormalizeName(family.c_str()));
+ ByteString match = MatchInstalledFonts(TT_NormalizeName(family.c_str()));
if (match.IsEmpty() && family != SubstName &&
(!bHasComma && (!bHasHyphen || (bHasHyphen && !bStyleAvail)))) {
match = MatchInstalledFonts(TT_NormalizeName(SubstName.c_str()));
@@ -742,7 +740,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(uint32_t dwUnicode,
if (ttc_size) {
face = GetCachedTTCFace(hFont, 0x74746366, ttc_size, font_size);
} else {
- CFX_ByteString SubstName;
+ ByteString SubstName;
m_pFontInfo->GetFaceName(hFont, &SubstName);
face = GetCachedFace(hFont, SubstName, weight, bItalic, font_size);
}
@@ -791,7 +789,7 @@ FXFT_Face CFX_FontMapper::GetCachedTTCFace(void* hFont,
}
FXFT_Face CFX_FontMapper::GetCachedFace(void* hFont,
- CFX_ByteString SubstName,
+ ByteString SubstName,
int weight,
bool bItalic,
uint32_t font_size) {
@@ -808,7 +806,7 @@ FXFT_Face CFX_FontMapper::GetCachedFace(void* hFont,
return face;
}
-int PDF_GetStandardFontName(CFX_ByteString* name) {
+int PDF_GetStandardFontName(ByteString* name) {
AltFontName* found = static_cast<AltFontName*>(
bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames),
sizeof(AltFontName), CompareString));
diff --git a/core/fxge/cfx_fontmapper.h b/core/fxge/cfx_fontmapper.h
index 1b262bf0f4..3f28c73150 100644
--- a/core/fxge/cfx_fontmapper.h
+++ b/core/fxge/cfx_fontmapper.h
@@ -23,10 +23,10 @@ class CFX_FontMapper {
void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo);
IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo.get(); }
- void AddInstalledFont(const CFX_ByteString& name, int charset);
+ void AddInstalledFont(const ByteString& name, int charset);
void LoadInstalledFonts();
- FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
+ FXFT_Face FindSubstFont(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -41,19 +41,17 @@ class CFX_FontMapper {
#endif // PDF_ENABLE_XFA
bool IsBuiltinFace(const FXFT_Face face) const;
int GetFaceSize() const;
- CFX_ByteString GetFaceName(int index) const {
- return m_FaceArray[index].name;
- }
+ ByteString GetFaceName(int index) const { return m_FaceArray[index].name; }
- std::vector<CFX_ByteString> m_InstalledTTFonts;
- std::vector<std::pair<CFX_ByteString, CFX_ByteString>> m_LocalizedTTFonts;
+ std::vector<ByteString> m_InstalledTTFonts;
+ std::vector<std::pair<ByteString, ByteString>> m_LocalizedTTFonts;
private:
static const size_t MM_FACE_COUNT = 2;
static const size_t FOXIT_FACE_COUNT = 14;
- CFX_ByteString GetPSNameFromTT(void* hFont);
- CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name);
+ ByteString GetPSNameFromTT(void* hFont);
+ ByteString MatchInstalledFonts(const ByteString& norm_name);
FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont,
int iBaseFont,
int italic_angle,
@@ -64,19 +62,19 @@ class CFX_FontMapper {
uint32_t ttc_size,
uint32_t font_size);
FXFT_Face GetCachedFace(void* hFont,
- CFX_ByteString SubstName,
+ ByteString SubstName,
int weight,
bool bItalic,
uint32_t font_size);
struct FaceData {
- CFX_ByteString name;
+ ByteString name;
uint32_t charset;
};
bool m_bListLoaded;
FXFT_Face m_MMFaces[MM_FACE_COUNT];
- CFX_ByteString m_LastFamily;
+ ByteString m_LastFamily;
std::vector<FaceData> m_FaceArray;
std::unique_ptr<IFX_SystemFontInfo> m_pFontInfo;
FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT];
diff --git a/core/fxge/cfx_fontmgr.cpp b/core/fxge/cfx_fontmgr.cpp
index c8beb515f0..f68598e4b6 100644
--- a/core/fxge/cfx_fontmgr.cpp
+++ b/core/fxge/cfx_fontmgr.cpp
@@ -46,18 +46,18 @@ const BuiltinFont g_MMFonts[2] = {
{g_FoxitSansMMFontData, 66919},
};
-CFX_ByteString KeyNameFromFace(const CFX_ByteString& face_name,
- int weight,
- bool bItalic) {
- CFX_ByteString key(face_name);
+ByteString KeyNameFromFace(const ByteString& face_name,
+ int weight,
+ bool bItalic) {
+ ByteString key(face_name);
key += ',';
- key += CFX_ByteString::FormatInteger(weight);
+ key += ByteString::FormatInteger(weight);
key += bItalic ? 'I' : 'N';
return key;
}
-CFX_ByteString KeyNameFromSize(int ttc_size, uint32_t checksum) {
- CFX_ByteString key;
+ByteString KeyNameFromSize(int ttc_size, uint32_t checksum) {
+ ByteString key;
key.Format("%d:%d", ttc_size, checksum);
return key;
}
@@ -110,7 +110,7 @@ void CFX_FontMgr::SetSystemFontInfo(
m_pBuiltinMapper->SetSystemFontInfo(std::move(pFontInfo));
}
-FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name,
+FXFT_Face CFX_FontMgr::FindSubstFont(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -122,7 +122,7 @@ FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name,
italic_angle, CharsetCP, pSubstFont);
}
-FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name,
+FXFT_Face CFX_FontMgr::GetCachedFace(const ByteString& face_name,
int weight,
bool bItalic,
uint8_t*& pFontData) {
@@ -136,7 +136,7 @@ FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name,
return pFontDesc->m_SingleFace;
}
-FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name,
+FXFT_Face CFX_FontMgr::AddCachedFace(const ByteString& face_name,
int weight,
bool bItalic,
uint8_t* pData,
diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h
index 7ccad807df..eddb1efd56 100644
--- a/core/fxge/cfx_fontmgr.h
+++ b/core/fxge/cfx_fontmgr.h
@@ -24,11 +24,11 @@ class CFX_FontMgr {
void InitFTLibrary();
- FXFT_Face GetCachedFace(const CFX_ByteString& face_name,
+ FXFT_Face GetCachedFace(const ByteString& face_name,
int weight,
bool bItalic,
uint8_t*& pFontData);
- FXFT_Face AddCachedFace(const CFX_ByteString& face_name,
+ FXFT_Face AddCachedFace(const ByteString& face_name,
int weight,
bool bItalic,
uint8_t* pData,
@@ -47,7 +47,7 @@ class CFX_FontMgr {
FXFT_Face GetFixedFace(const uint8_t* pData, uint32_t size, int face_index);
void ReleaseFace(FXFT_Face face);
void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo);
- FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
+ FXFT_Face FindSubstFont(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -61,7 +61,7 @@ class CFX_FontMgr {
private:
std::unique_ptr<CFX_FontMapper> m_pBuiltinMapper;
- std::map<CFX_ByteString, std::unique_ptr<CTTFontDesc>> m_FaceMap;
+ std::map<ByteString, std::unique_ptr<CTTFontDesc>> m_FaceMap;
FXFT_Library m_FTLibrary;
bool m_FTLibrarySupportsHinting;
};
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 959c909b5e..5e9f5ae0c9 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -336,7 +336,7 @@ bool ShouldDrawDeviceText(const CFX_Font* pFont, uint32_t text_flags) {
if (text_flags & FXFONT_CIDFONT)
return false;
- const CFX_ByteString bsPsName = pFont->GetPsName();
+ const ByteString bsPsName = pFont->GetPsName();
if (bsPsName.Contains("+ZJHL"))
return false;
diff --git a/core/fxge/cfx_substfont.h b/core/fxge/cfx_substfont.h
index 01196d442a..5225bd38f3 100644
--- a/core/fxge/cfx_substfont.h
+++ b/core/fxge/cfx_substfont.h
@@ -16,7 +16,7 @@ class CFX_SubstFont {
public:
CFX_SubstFont();
- CFX_ByteString m_Family;
+ ByteString m_Family;
int m_Charset;
uint32_t m_SubstFlags;
int m_Weight;
diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h
index 57fdb54821..021efee7d9 100644
--- a/core/fxge/fx_font.h
+++ b/core/fxge/fx_font.h
@@ -87,7 +87,7 @@ class CFX_Font {
CFX_Font();
~CFX_Font();
- void LoadSubst(const CFX_ByteString& face_name,
+ void LoadSubst(const ByteString& face_name,
bool bTrueType,
uint32_t flags,
int weight,
@@ -130,9 +130,9 @@ class CFX_Font {
bool IsBold() const;
bool IsFixedWidth() const;
bool IsVertical() const { return m_bVertical; }
- CFX_ByteString GetPsName() const;
- CFX_ByteString GetFamilyName() const;
- CFX_ByteString GetFaceName() const;
+ ByteString GetPsName() const;
+ ByteString GetFamilyName() const;
+ ByteString GetFaceName() const;
bool IsTTFont() const;
bool GetBBox(FX_RECT& bbox);
bool IsEmbedded() const { return m_bEmbedded; }
@@ -183,15 +183,15 @@ class CFX_Font {
class CFX_FontFaceInfo {
public:
- CFX_FontFaceInfo(CFX_ByteString filePath,
- CFX_ByteString faceName,
- CFX_ByteString fontTables,
+ CFX_FontFaceInfo(ByteString filePath,
+ ByteString faceName,
+ ByteString fontTables,
uint32_t fontOffset,
uint32_t fileSize);
- const CFX_ByteString m_FilePath;
- const CFX_ByteString m_FaceName;
- const CFX_ByteString m_FontTables;
+ const ByteString m_FilePath;
+ const ByteString m_FaceName;
+ const ByteString m_FontTables;
const uint32_t m_FontOffset;
const uint32_t m_FileSize;
uint32_t m_Styles;
@@ -229,10 +229,10 @@ FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs,
float retinaScaleX,
float retinaScaleY);
-CFX_ByteString GetNameFromTT(const uint8_t* name_table,
- uint32_t name_table_size,
- uint32_t name);
+ByteString GetNameFromTT(const uint8_t* name_table,
+ uint32_t name_table_size,
+ uint32_t name);
-int PDF_GetStandardFontName(CFX_ByteString* name);
+int PDF_GetStandardFontName(ByteString* name);
#endif // CORE_FXGE_FX_FONT_H_
diff --git a/core/fxge/fx_ge_fontmap.cpp b/core/fxge/fx_ge_fontmap.cpp
index 7ac4fada5c..0f2703875d 100644
--- a/core/fxge/fx_ge_fontmap.cpp
+++ b/core/fxge/fx_ge_fontmap.cpp
@@ -9,28 +9,28 @@
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/ifx_systemfontinfo.h"
-static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr,
- uint32_t string_ptr_length,
- uint16_t offset,
- uint16_t length) {
+static ByteString GetStringFromTable(const uint8_t* string_ptr,
+ uint32_t string_ptr_length,
+ uint16_t offset,
+ uint16_t length) {
if (string_ptr_length < static_cast<uint32_t>(offset + length)) {
- return CFX_ByteString();
+ return ByteString();
}
- return CFX_ByteString(string_ptr + offset, length);
+ return ByteString(string_ptr + offset, length);
}
-CFX_ByteString GetNameFromTT(const uint8_t* name_table,
- uint32_t name_table_size,
- uint32_t name_id) {
+ByteString GetNameFromTT(const uint8_t* name_table,
+ uint32_t name_table_size,
+ uint32_t name_id) {
if (!name_table || name_table_size < 6) {
- return CFX_ByteString();
+ return ByteString();
}
uint32_t name_count = GET_TT_SHORT(name_table + 2);
uint32_t string_offset = GET_TT_SHORT(name_table + 4);
// We will ignore the possibility of overlap of structures and
// string table as if it's all corrupt there's not a lot we can do.
if (name_table_size < string_offset) {
- return CFX_ByteString();
+ return ByteString();
}
const uint8_t* string_ptr = name_table + string_offset;
@@ -38,7 +38,7 @@ CFX_ByteString GetNameFromTT(const uint8_t* name_table,
name_table += 6;
name_table_size -= 6;
if (name_table_size < name_count * 12) {
- return CFX_ByteString();
+ return ByteString();
}
for (uint32_t i = 0; i < name_count; i++, name_table += 12) {
@@ -49,7 +49,7 @@ CFX_ByteString GetNameFromTT(const uint8_t* name_table,
GET_TT_SHORT(name_table + 8));
}
}
- return CFX_ByteString();
+ return ByteString();
}
#ifdef PDF_ENABLE_XFA
void* IFX_SystemFontInfo::MapFontByUnicode(uint32_t dwUnicode,
@@ -79,9 +79,9 @@ std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault(
}
#endif
-CFX_FontFaceInfo::CFX_FontFaceInfo(CFX_ByteString filePath,
- CFX_ByteString faceName,
- CFX_ByteString fontTables,
+CFX_FontFaceInfo::CFX_FontFaceInfo(ByteString filePath,
+ ByteString faceName,
+ ByteString fontTables,
uint32_t fontOffset,
uint32_t fileSize)
: m_FilePath(filePath),
diff --git a/core/fxge/fx_ge_linux.cpp b/core/fxge/fx_ge_linux.cpp
index d17ddf2d3d..650510f63e 100644
--- a/core/fxge/fx_ge_linux.cpp
+++ b/core/fxge/fx_ge_linux.cpp
@@ -44,7 +44,7 @@ const char* const g_LinuxHGFontList[] = {
size_t GetJapanesePreference(const char* facearr,
int weight,
int pitch_family) {
- CFX_ByteString face = facearr;
+ ByteString face = facearr;
if (face.Contains("Gothic") ||
face.Contains("\x83\x53\x83\x56\x83\x62\x83\x4e")) {
if (face.Contains("PGothic") ||
diff --git a/core/fxge/ifx_systemfontinfo.h b/core/fxge/ifx_systemfontinfo.h
index ca7ca2c455..cb85f7fde4 100644
--- a/core/fxge/ifx_systemfontinfo.h
+++ b/core/fxge/ifx_systemfontinfo.h
@@ -42,7 +42,7 @@ class IFX_SystemFontInfo {
uint32_t table,
uint8_t* buffer,
uint32_t size) = 0;
- virtual bool GetFaceName(void* hFont, CFX_ByteString* name) = 0;
+ virtual bool GetFaceName(void* hFont, ByteString* name) = 0;
virtual bool GetFontCharset(void* hFont, int* charset) = 0;
virtual int GetFaceIndex(void* hFont);
virtual void DeleteFont(void* hFont) = 0;
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index c02058d1dd..5586d9f921 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -669,9 +669,9 @@ bool CFX_PSRenderer::DrawText(int nChars,
last_fontnum = ps_fontnum;
}
buf << pCharPos[i].m_Origin.x << " " << pCharPos[i].m_Origin.y << " m";
- CFX_ByteString hex;
+ ByteString hex;
hex.Format("<%02X>", ps_glyphindex);
- buf << hex.AsStringC() << "Tj\n";
+ buf << hex.AsStringView() << "Tj\n";
}
buf << "Q\n";
m_pStream->WriteBlock(buf.str().c_str(), buf.tellp());
diff --git a/core/fxge/win32/cfx_windowsdib.h b/core/fxge/win32/cfx_windowsdib.h
index 3ecbb5835d..28f152acfa 100644
--- a/core/fxge/win32/cfx_windowsdib.h
+++ b/core/fxge/win32/cfx_windowsdib.h
@@ -33,8 +33,7 @@ class CFX_WindowsDIB : public CFX_DIBitmap {
~CFX_WindowsDIB() override;
- static CFX_ByteString GetBitmapInfo(
- const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
+ static ByteString GetBitmapInfo(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap);
static HBITMAP GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
HDC hDC);
diff --git a/core/fxge/win32/cpsoutput.cpp b/core/fxge/win32/cpsoutput.cpp
index 1af6dbdced..83f2fc09c6 100644
--- a/core/fxge/win32/cpsoutput.cpp
+++ b/core/fxge/win32/cpsoutput.cpp
@@ -31,6 +31,6 @@ bool CPSOutput::WriteBlock(const void* str, size_t len) {
return true;
}
-bool CPSOutput::WriteString(const CFX_ByteStringC& str) {
+bool CPSOutput::WriteString(const ByteStringView& str) {
return WriteBlock(str.unterminated_c_str(), str.GetLength());
}
diff --git a/core/fxge/win32/cpsoutput.h b/core/fxge/win32/cpsoutput.h
index 42ad109a80..d140de95f4 100644
--- a/core/fxge/win32/cpsoutput.h
+++ b/core/fxge/win32/cpsoutput.h
@@ -19,7 +19,7 @@ class CPSOutput : public IFX_WriteStream {
// IFX_Writestream
bool WriteBlock(const void* str, size_t len) override;
- bool WriteString(const CFX_ByteStringC& str) override;
+ bool WriteString(const ByteStringView& str) override;
private:
HDC m_hDC;
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 9c8da591c6..bb7bf6fea1 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -73,7 +73,7 @@ const FontNameMap g_JpFontNameMap[] = {
{"MS Gothic", "Jun101-Light"},
};
-bool GetSubFontName(CFX_ByteString* name) {
+bool GetSubFontName(ByteString* name) {
for (size_t i = 0; i < FX_ArraySize(g_JpFontNameMap); ++i) {
if (!FXSYS_stricmp(name->c_str(), g_JpFontNameMap[i].m_pSrcFontName)) {
*name = g_JpFontNameMap[i].m_pSubFontName;
@@ -349,23 +349,21 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo {
uint32_t table,
uint8_t* buffer,
uint32_t size) override;
- bool GetFaceName(void* hFont, CFX_ByteString* name) override;
+ bool GetFaceName(void* hFont, ByteString* name) override;
bool GetFontCharset(void* hFont, int* charset) override;
void DeleteFont(void* hFont) override;
bool IsOpenTypeFromDiv(const LOGFONTA* plf);
bool IsSupportFontFormDiv(const LOGFONTA* plf);
void AddInstalledFont(const LOGFONTA* plf, uint32_t FontType);
- void GetGBPreference(CFX_ByteString& face, int weight, int picth_family);
- void GetJapanesePreference(CFX_ByteString& face,
- int weight,
- int picth_family);
- CFX_ByteString FindFont(const CFX_ByteString& name);
+ void GetGBPreference(ByteString& face, int weight, int picth_family);
+ void GetJapanesePreference(ByteString& face, int weight, int picth_family);
+ ByteString FindFont(const ByteString& name);
HDC m_hDC;
CFX_UnownedPtr<CFX_FontMapper> m_pMapper;
- CFX_ByteString m_LastFamily;
- CFX_ByteString m_KaiTi, m_FangSong;
+ ByteString m_LastFamily;
+ ByteString m_KaiTi, m_FangSong;
};
int CALLBACK FontEnumProc(const LOGFONTA* plf,
@@ -429,7 +427,7 @@ bool CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) {
void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf,
uint32_t FontType) {
- CFX_ByteString name(plf->lfFaceName);
+ ByteString name(plf->lfFaceName);
if (name.GetLength() > 0 && name[0] == '@')
return;
@@ -458,21 +456,21 @@ bool CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) {
return true;
}
-CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) {
+ByteString CFX_Win32FontInfo::FindFont(const ByteString& name) {
if (!m_pMapper)
return name;
for (size_t i = 0; i < m_pMapper->m_InstalledTTFonts.size(); ++i) {
- CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i];
+ ByteString thisname = m_pMapper->m_InstalledTTFonts[i];
if (thisname.Left(name.GetLength()) == name)
return m_pMapper->m_InstalledTTFonts[i];
}
for (size_t i = 0; i < m_pMapper->m_LocalizedTTFonts.size(); ++i) {
- CFX_ByteString thisname = m_pMapper->m_LocalizedTTFonts[i].first;
+ ByteString thisname = m_pMapper->m_LocalizedTTFonts[i].first;
if (thisname.Left(name.GetLength()) == name)
return m_pMapper->m_LocalizedTTFonts[i].second;
}
- return CFX_ByteString();
+ return ByteString();
}
void* CFX_Win32FallbackFontInfo::MapFont(int weight,
@@ -500,7 +498,7 @@ void* CFX_Win32FallbackFontInfo::MapFont(int weight,
return FindFont(weight, bItalic, charset, pitch_family, cstr_face, !bCJK);
}
-void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face,
+void CFX_Win32FontInfo::GetGBPreference(ByteString& face,
int weight,
int picth_family) {
if (face.Contains("KaiTi") || face.Contains("\xbf\xac")) {
@@ -530,7 +528,7 @@ void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face,
}
}
-void CFX_Win32FontInfo::GetJapanesePreference(CFX_ByteString& face,
+void CFX_Win32FontInfo::GetJapanesePreference(ByteString& face,
int weight,
int picth_family) {
if (face.Contains("Gothic") ||
@@ -573,10 +571,10 @@ void* CFX_Win32FontInfo::MapFont(int weight,
int pitch_family,
const char* cstr_face,
int& iExact) {
- CFX_ByteString face = cstr_face;
+ ByteString face = cstr_face;
int iBaseFont;
for (iBaseFont = 0; iBaseFont < 12; iBaseFont++)
- if (face == CFX_ByteStringC(g_Base14Substs[iBaseFont].m_pName)) {
+ if (face == ByteStringView(g_Base14Substs[iBaseFont].m_pName)) {
face = g_Base14Substs[iBaseFont].m_pWinName;
weight = g_Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL;
bItalic = g_Base14Substs[iBaseFont].m_bItalic;
@@ -607,15 +605,15 @@ void* CFX_Win32FontInfo::MapFont(int weight,
if (face.EqualNoCase(facebuf))
return hFont;
- CFX_WideString wsFace = CFX_WideString::FromLocal(facebuf);
+ WideString wsFace = WideString::FromLocal(facebuf);
for (size_t i = 0; i < FX_ArraySize(g_VariantNames); ++i) {
if (face != g_VariantNames[i].m_pFaceName)
continue;
const unsigned short* pName = reinterpret_cast<const unsigned short*>(
g_VariantNames[i].m_pVariantName);
- FX_STRSIZE len = CFX_WideString::WStringLength(pName);
- CFX_WideString wsName = CFX_WideString::FromUTF16LE(pName, len);
+ FX_STRSIZE len = WideString::WStringLength(pName);
+ WideString wsName = WideString::FromUTF16LE(pName, len);
if (wsFace == wsName)
return hFont;
}
@@ -665,7 +663,7 @@ uint32_t CFX_Win32FontInfo::GetFontData(void* hFont,
return size;
}
-bool CFX_Win32FontInfo::GetFaceName(void* hFont, CFX_ByteString* name) {
+bool CFX_Win32FontInfo::GetFaceName(void* hFont, ByteString* name) {
char facebuf[100];
HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
int ret = ::GetTextFaceA(m_hDC, 100, facebuf);
@@ -702,7 +700,7 @@ std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault(
CHAR windows_path[MAX_PATH] = {};
DWORD path_len = ::GetWindowsDirectoryA(windows_path, MAX_PATH);
if (path_len > 0 && path_len < MAX_PATH) {
- CFX_ByteString fonts_path(windows_path);
+ ByteString fonts_path(windows_path);
fonts_path += "\\Fonts";
pInfoFallback->AddPath(fonts_path);
}
@@ -799,7 +797,7 @@ bool CGdiDeviceDriver::GDI_SetDIBits(
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
- CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
+ ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1;
FX_RECT dst_rect(0, 0, width, height);
dst_rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
@@ -817,7 +815,7 @@ bool CGdiDeviceDriver::GDI_SetDIBits(
}
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
- CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
+ ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
::SetDIBitsToDevice(m_hDC, left, top, width, height, pSrcRect->left,
pBitmap->GetHeight() - pSrcRect->bottom, 0,
pBitmap->GetHeight(), pBuffer,
@@ -840,7 +838,7 @@ bool CGdiDeviceDriver::GDI_StretchDIBits(
if (pBitmap->IsCmykImage() && !pBitmap->ConvertFormat(FXDIB_Rgb))
return false;
- CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
+ ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
if ((int64_t)abs(dest_width) * abs(dest_height) <
(int64_t)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 ||
(flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) {
@@ -854,7 +852,7 @@ bool CGdiDeviceDriver::GDI_StretchDIBits(
(int64_t)abs(dest_width) * abs(dest_height))) {
pToStrechBitmap = pBitmap->StretchTo(dest_width, dest_height, 0, nullptr);
}
- CFX_ByteString toStrechBitmapInfo =
+ ByteString toStrechBitmapInfo =
CFX_WindowsDIB::GetBitmapInfo(pToStrechBitmap);
::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, 0, 0,
pToStrechBitmap->GetWidth(), pToStrechBitmap->GetHeight(),
diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp
index d1e5688ee1..c00543b169 100644
--- a/core/fxge/win32/fx_win32_dib.cpp
+++ b/core/fxge/win32/fx_win32_dib.cpp
@@ -11,9 +11,9 @@
#include "core/fxge/win32/cfx_windowsdib.h"
#include "core/fxge/win32/win32_int.h"
-CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(
+ByteString CFX_WindowsDIB::GetBitmapInfo(
const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
- CFX_ByteString result;
+ ByteString result;
int len = sizeof(BITMAPINFOHEADER);
if (pBitmap->GetBPP() == 1 || pBitmap->GetBPP() == 8) {
len += sizeof(DWORD) * (int)(1 << pBitmap->GetBPP());
@@ -102,7 +102,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi,
HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap,
HDC hDC) {
- CFX_ByteString info = GetBitmapInfo(pBitmap);
+ ByteString info = GetBitmapInfo(pBitmap);
return CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT,
pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(),
DIB_RGB_COLORS);
@@ -139,7 +139,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(
DeleteDC(hDC);
return nullptr;
}
- CFX_ByteString info = GetBitmapInfo(pDIBitmap);
+ ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
DeleteDC(hDC);
@@ -149,7 +149,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(
}
CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(const char* filename) {
- return LoadFromFile(CFX_WideString::FromLocal(filename).c_str());
+ return LoadFromFile(WideString::FromLocal(filename).c_str());
}
CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap(
@@ -175,7 +175,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap(
DeleteDC(hDC);
return nullptr;
}
- CFX_ByteString info = GetBitmapInfo(pDIBitmap);
+ ByteString info = GetBitmapInfo(pDIBitmap);
int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
(BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
DeleteDC(hDC);
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp
index 04788d6138..8161c5d333 100644
--- a/core/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/fxge/win32/fx_win32_gdipext.cpp
@@ -682,7 +682,7 @@ CGdiplusExt::CGdiplusExt() {
m_pGdiRemoveFontMemResourseEx = nullptr;
}
void CGdiplusExt::Load() {
- CFX_ByteString strPlusPath = "";
+ ByteString strPlusPath = "";
char buf[MAX_PATH];
GetSystemDirectoryA(buf, MAX_PATH);
strPlusPath += buf;
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index ecd7be57c7..fa2c8b7ef3 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -232,7 +232,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars,
lf.lfItalic = pFont->IsItalic();
lf.lfCharSet = DEFAULT_CHARSET;
- const CFX_WideString wsName = pFont->GetFaceName().UTF8Decode();
+ const WideString wsName = pFont->GetFaceName().UTF8Decode();
size_t iNameLen =
std::min(wsName.GetLength(), static_cast<size_t>(LF_FACESIZE - 1));
memcpy(lf.lfFaceName, wsName.c_str(), sizeof(lf.lfFaceName[0]) * iNameLen);
@@ -288,7 +288,7 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars,
SetBkMode(m_hDC, TRANSPARENT);
// Text
- CFX_WideString wsText;
+ WideString wsText;
std::vector<INT> spacing(nChars);
float fPreviousOriginX = 0;
for (int i = 0; i < nChars; ++i) {
@@ -609,7 +609,7 @@ bool CTextOnlyPrinterDriver::DrawDeviceText(int nChars,
// errors below. Value chosen based on the title of https://crbug.com/18383
const double kScaleFactor = 10;
- CFX_WideString wsText;
+ WideString wsText;
int totalLength = nChars;
// Detect new lines and add clrf characters (since this is Windows only).
@@ -638,7 +638,7 @@ bool CTextOnlyPrinterDriver::DrawDeviceText(int nChars,
wsText += charpos.m_Unicode;
}
size_t len = totalLength;
- CFX_ByteString text = CFX_ByteString::FromUnicode(wsText);
+ ByteString text = ByteString::FromUnicode(wsText);
while (len > 0) {
char buffer[1026];
size_t send_len = std::min(len, static_cast<size_t>(1024));
diff --git a/fpdfsdk/cba_annotiterator.cpp b/fpdfsdk/cba_annotiterator.cpp
index 3e35ff8294..d1c9599cf6 100644
--- a/fpdfsdk/cba_annotiterator.cpp
+++ b/fpdfsdk/cba_annotiterator.cpp
@@ -34,7 +34,7 @@ CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView,
m_pPageView(pPageView),
m_nAnnotSubtype(nAnnotSubtype) {
CPDF_Page* pPDFPage = m_pPageView->GetPDFPage();
- CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetStringFor("Tabs");
+ ByteString sTabs = pPDFPage->m_pFormDict->GetStringFor("Tabs");
if (sTabs == "R")
m_eTabOrder = ROW;
else if (sTabs == "C")
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index c8b1ef4b04..9534d7bd19 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -89,7 +89,7 @@ void CFX_SystemHandler::SetCursor(int32_t nCursorType) {
m_pFormFillEnv->SetCursor(nCursorType);
}
-bool CFX_SystemHandler::FindNativeTrueTypeFont(CFX_ByteString sFontFaceName) {
+bool CFX_SystemHandler::FindNativeTrueTypeFont(ByteString sFontFaceName) {
CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
if (!pFontMgr)
return false;
@@ -102,11 +102,11 @@ bool CFX_SystemHandler::FindNativeTrueTypeFont(CFX_ByteString sFontFaceName) {
pFontMapper->LoadInstalledFonts();
for (const auto& font : pFontMapper->m_InstalledTTFonts) {
- if (font.Compare(sFontFaceName.AsStringC()))
+ if (font.Compare(sFontFaceName.AsStringView()))
return true;
}
for (const auto& fontPair : pFontMapper->m_LocalizedTTFonts) {
- if (fontPair.first.Compare(sFontFaceName.AsStringC()))
+ if (fontPair.first.Compare(sFontFaceName.AsStringView()))
return true;
}
return false;
@@ -114,7 +114,7 @@ bool CFX_SystemHandler::FindNativeTrueTypeFont(CFX_ByteString sFontFaceName) {
CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(
CPDF_Document* pDoc,
- CFX_ByteString sFontFaceName,
+ ByteString sFontFaceName,
uint8_t nCharset) {
if (!pDoc)
return nullptr;
diff --git a/fpdfsdk/cfx_systemhandler.h b/fpdfsdk/cfx_systemhandler.h
index c52630533f..a2ad02438e 100644
--- a/fpdfsdk/cfx_systemhandler.h
+++ b/fpdfsdk/cfx_systemhandler.h
@@ -58,9 +58,9 @@ class CFX_SystemHandler {
void OutputSelectedRect(CFFL_FormFiller* pFormFiller, CFX_FloatRect& rect);
bool IsSelectionImplemented() const;
void SetCursor(int32_t nCursorType);
- bool FindNativeTrueTypeFont(CFX_ByteString sFontFaceName);
+ bool FindNativeTrueTypeFont(ByteString sFontFaceName);
CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc,
- CFX_ByteString sFontFaceName,
+ ByteString sFontFaceName,
uint8_t nCharset);
int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc);
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index a1ac14cc69..2966b4d19b 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -76,14 +76,13 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) {
GetAnnotHandler(pAnnot)->OnLoad(pAnnot);
}
-CFX_WideString CPDFSDK_AnnotHandlerMgr::Annot_GetSelectedText(
+WideString CPDFSDK_AnnotHandlerMgr::Annot_GetSelectedText(
CPDFSDK_Annot* pAnnot) {
return GetAnnotHandler(pAnnot)->GetSelectedText(pAnnot);
}
-void CPDFSDK_AnnotHandlerMgr::Annot_ReplaceSelection(
- CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {
+void CPDFSDK_AnnotHandlerMgr::Annot_ReplaceSelection(CPDFSDK_Annot* pAnnot,
+ const WideString& text) {
GetAnnotHandler(pAnnot)->ReplaceSelection(pAnnot, text);
}
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h
index 32f8b4a526..21ccb3a2fb 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.h
@@ -42,9 +42,8 @@ class CPDFSDK_AnnotHandlerMgr {
void Annot_OnCreate(CPDFSDK_Annot* pAnnot);
void Annot_OnLoad(CPDFSDK_Annot* pAnnot);
- CFX_WideString Annot_GetSelectedText(CPDFSDK_Annot* pAnnot);
- void Annot_ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text);
+ WideString Annot_GetSelectedText(CPDFSDK_Annot* pAnnot);
+ void Annot_ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text);
IPDFSDK_AnnotHandler* GetAnnotHandler(CPDFSDK_Annot* pAnnot) const;
void Annot_OnDraw(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index 9f21d3c7e4..711d228ec3 100644
--- a/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -101,7 +101,7 @@ void CPDFSDK_BAAnnot::ClearCachedAP() {
m_pAnnot->ClearCachedAP();
}
-void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) {
+void CPDFSDK_BAAnnot::SetContents(const WideString& sContents) {
if (sContents.IsEmpty()) {
m_pAnnot->GetAnnotDict()->RemoveFor("Contents");
} else {
@@ -110,11 +110,11 @@ void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) {
}
}
-CFX_WideString CPDFSDK_BAAnnot::GetContents() const {
+WideString CPDFSDK_BAAnnot::GetContents() const {
return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("Contents");
}
-void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) {
+void CPDFSDK_BAAnnot::SetAnnotName(const WideString& sName) {
if (sName.IsEmpty()) {
m_pAnnot->GetAnnotDict()->RemoveFor("NM");
} else {
@@ -123,13 +123,13 @@ void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) {
}
}
-CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const {
+WideString CPDFSDK_BAAnnot::GetAnnotName() const {
return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("NM");
}
void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) {
CPDFSDK_DateTime dt(st);
- CFX_ByteString str = dt.ToPDFDateTimeString();
+ ByteString str = dt.ToPDFDateTimeString();
if (str.IsEmpty())
m_pAnnot->GetAnnotDict()->RemoveFor("M");
else
@@ -138,7 +138,7 @@ void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) {
FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const {
FX_SYSTEMTIME systime;
- CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M");
+ ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M");
CPDFSDK_DateTime dt(str);
dt.ToSystemTime(systime);
return systime;
@@ -153,14 +153,14 @@ uint32_t CPDFSDK_BAAnnot::GetFlags() const {
return m_pAnnot->GetAnnotDict()->GetIntegerFor("F");
}
-void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) {
+void CPDFSDK_BAAnnot::SetAppState(const ByteString& str) {
if (str.IsEmpty())
m_pAnnot->GetAnnotDict()->RemoveFor("AS");
else
m_pAnnot->GetAnnotDict()->SetNewFor<CPDF_String>("AS", str, false);
}
-CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const {
+ByteString CPDFSDK_BAAnnot::GetAppState() const {
return m_pAnnot->GetAnnotDict()->GetStringFor("AS");
}
@@ -225,7 +225,7 @@ void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) {
BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const {
CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
if (pBSDict) {
- CFX_ByteString sBorderStyle = pBSDict->GetStringFor("S", "S");
+ ByteString sBorderStyle = pBSDict->GetStringFor("S", "S");
if (sBorderStyle == "S")
return BorderStyle::SOLID;
if (sBorderStyle == "D")
diff --git a/fpdfsdk/cpdfsdk_baannot.h b/fpdfsdk/cpdfsdk_baannot.h
index 3b60b1b1b8..1d71585a35 100644
--- a/fpdfsdk/cpdfsdk_baannot.h
+++ b/fpdfsdk/cpdfsdk_baannot.h
@@ -38,11 +38,11 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot {
CPDF_Dictionary* GetAPDict() const;
- void SetContents(const CFX_WideString& sContents);
- CFX_WideString GetContents() const;
+ void SetContents(const WideString& sContents);
+ WideString GetContents() const;
- void SetAnnotName(const CFX_WideString& sName);
- CFX_WideString GetAnnotName() const;
+ void SetAnnotName(const WideString& sName);
+ WideString GetAnnotName() const;
void SetModifiedDate(const FX_SYSTEMTIME& st);
FX_SYSTEMTIME GetModifiedDate() const;
@@ -50,8 +50,8 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot {
void SetFlags(uint32_t nFlags);
uint32_t GetFlags() const;
- void SetAppState(const CFX_ByteString& str);
- CFX_ByteString GetAppState() const;
+ void SetAppState(const ByteString& str);
+ ByteString GetAppState() const;
void SetStructParent(int key);
int GetStructParent() const;
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index 6cf399a04a..027527ec5f 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -193,12 +193,12 @@ CFX_FloatRect CPDFSDK_BAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
return pAnnot->GetRect();
}
-CFX_WideString CPDFSDK_BAAnnotHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
- return CFX_WideString();
+WideString CPDFSDK_BAAnnotHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
+ return WideString();
}
void CPDFSDK_BAAnnotHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {}
+ const WideString& text) {}
bool CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h
index 2ed9ed8334..7bf8034a54 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/cpdfsdk_baannothandler.h
@@ -36,9 +36,8 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler {
void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) override;
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
- void ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) override;
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override;
bool HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
const CFX_PointF& point) override;
diff --git a/fpdfsdk/cpdfsdk_datetime.cpp b/fpdfsdk/cpdfsdk_datetime.cpp
index d2653fca74..ce22cae12f 100644
--- a/fpdfsdk/cpdfsdk_datetime.cpp
+++ b/fpdfsdk/cpdfsdk_datetime.cpp
@@ -63,7 +63,7 @@ CPDFSDK_DateTime::CPDFSDK_DateTime() {
ResetDateTime();
}
-CPDFSDK_DateTime::CPDFSDK_DateTime(const CFX_ByteString& dtStr) {
+CPDFSDK_DateTime::CPDFSDK_DateTime(const ByteString& dtStr) {
ResetDateTime();
FromPDFDateTimeString(dtStr);
}
@@ -129,7 +129,7 @@ time_t CPDFSDK_DateTime::ToTime_t() const {
}
CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
- const CFX_ByteString& dtStr) {
+ const ByteString& dtStr) {
int strLength = dtStr.GetLength();
if (strLength <= 0)
return *this;
@@ -263,34 +263,34 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
return *this;
}
-CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() {
- CFX_ByteString str1;
+ByteString CPDFSDK_DateTime::ToCommonDateTimeString() {
+ ByteString str1;
str1.Format("%04d-%02u-%02u %02u:%02u:%02u ", m_year, m_month, m_day, m_hour,
m_minute, m_second);
if (m_tzHour < 0)
str1 += "-";
else
str1 += "+";
- CFX_ByteString str2;
+ ByteString str2;
str2.Format("%02d:%02u", std::abs(static_cast<int>(m_tzHour)), m_tzMinute);
return str1 + str2;
}
-CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() {
- CFX_ByteString dtStr;
+ByteString CPDFSDK_DateTime::ToPDFDateTimeString() {
+ ByteString dtStr;
char tempStr[32];
memset(tempStr, 0, sizeof(tempStr));
FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02u%02u%02u%02u%02u",
m_year, m_month, m_day, m_hour, m_minute, m_second);
- dtStr = CFX_ByteString(tempStr);
+ dtStr = ByteString(tempStr);
if (m_tzHour < 0)
- dtStr += CFX_ByteString("-");
+ dtStr += ByteString("-");
else
- dtStr += CFX_ByteString("+");
+ dtStr += ByteString("+");
memset(tempStr, 0, sizeof(tempStr));
FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'",
std::abs(static_cast<int>(m_tzHour)), m_tzMinute);
- dtStr += CFX_ByteString(tempStr);
+ dtStr += ByteString(tempStr);
return dtStr;
}
diff --git a/fpdfsdk/cpdfsdk_datetime.h b/fpdfsdk/cpdfsdk_datetime.h
index 6b612b27bc..08d43cc200 100644
--- a/fpdfsdk/cpdfsdk_datetime.h
+++ b/fpdfsdk/cpdfsdk_datetime.h
@@ -18,16 +18,16 @@
class CPDFSDK_DateTime {
public:
CPDFSDK_DateTime();
- explicit CPDFSDK_DateTime(const CFX_ByteString& dtStr);
+ explicit CPDFSDK_DateTime(const ByteString& dtStr);
explicit CPDFSDK_DateTime(const FX_SYSTEMTIME& st);
CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime);
bool operator==(const CPDFSDK_DateTime& datetime) const;
bool operator!=(const CPDFSDK_DateTime& datetime) const;
- CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr);
- CFX_ByteString ToCommonDateTimeString();
- CFX_ByteString ToPDFDateTimeString();
+ CPDFSDK_DateTime& FromPDFDateTimeString(const ByteString& dtStr);
+ ByteString ToCommonDateTimeString();
+ ByteString ToPDFDateTimeString();
void ToSystemTime(FX_SYSTEMTIME& st);
time_t ToTime_t() const;
CPDFSDK_DateTime ToGMT() const;
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index a258026a7d..300a742809 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -24,7 +24,7 @@ namespace {
// NOTE: |bsUTF16LE| must outlive the use of the result. Care must be taken
// since modifying the result would impact |bsUTF16LE|.
-FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE) {
+FPDF_WIDESTRING AsFPDFWideString(ByteString* bsUTF16LE) {
return reinterpret_cast<FPDF_WIDESTRING>(
bsUTF16LE->GetBuffer(bsUTF16LE->GetLength()));
}
@@ -69,8 +69,8 @@ int CPDFSDK_FormFillEnvironment::JS_appAlert(const wchar_t* Msg,
!m_pInfo->m_pJsPlatform->app_alert) {
return -1;
}
- CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
- CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
+ ByteString bsMsg = WideString(Msg).UTF16LE_Encode();
+ ByteString bsTitle = WideString(Title).UTF16LE_Encode();
return m_pInfo->m_pJsPlatform->app_alert(
m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsMsg),
AsFPDFWideString(&bsTitle), Type, Icon);
@@ -87,10 +87,10 @@ int CPDFSDK_FormFillEnvironment::JS_appResponse(const wchar_t* Question,
!m_pInfo->m_pJsPlatform->app_response) {
return -1;
}
- CFX_ByteString bsQuestion = CFX_WideString(Question).UTF16LE_Encode();
- CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
- CFX_ByteString bsDefault = CFX_WideString(Default).UTF16LE_Encode();
- CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_Encode();
+ ByteString bsQuestion = WideString(Question).UTF16LE_Encode();
+ ByteString bsTitle = WideString(Title).UTF16LE_Encode();
+ ByteString bsDefault = WideString(Default).UTF16LE_Encode();
+ ByteString bsLabel = WideString(cLabel).UTF16LE_Encode();
return m_pInfo->m_pJsPlatform->app_response(
m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsQuestion),
AsFPDFWideString(&bsTitle), AsFPDFWideString(&bsDefault),
@@ -105,44 +105,44 @@ void CPDFSDK_FormFillEnvironment::JS_appBeep(int nType) {
m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType);
}
-CFX_WideString CPDFSDK_FormFillEnvironment::JS_fieldBrowse() {
+WideString CPDFSDK_FormFillEnvironment::JS_fieldBrowse() {
if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
!m_pInfo->m_pJsPlatform->Field_browse) {
- return CFX_WideString();
+ return WideString();
}
const int nRequiredLen =
m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, nullptr, 0);
if (nRequiredLen <= 0)
- return CFX_WideString();
+ return WideString();
std::vector<uint8_t> pBuff(nRequiredLen);
const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse(
m_pInfo->m_pJsPlatform, pBuff.data(), nRequiredLen);
if (nActualLen <= 0 || nActualLen > nRequiredLen)
- return CFX_WideString();
+ return WideString();
pBuff.resize(nActualLen);
- return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff));
+ return WideString::FromLocal(ByteStringView(pBuff));
}
-CFX_WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() {
+WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() {
if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
!m_pInfo->m_pJsPlatform->Doc_getFilePath) {
- return CFX_WideString();
+ return WideString();
}
const int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
m_pInfo->m_pJsPlatform, nullptr, 0);
if (nRequiredLen <= 0)
- return CFX_WideString();
+ return WideString();
std::vector<uint8_t> pBuff(nRequiredLen);
const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
m_pInfo->m_pJsPlatform, pBuff.data(), nRequiredLen);
if (nActualLen <= 0 || nActualLen > nRequiredLen)
- return CFX_WideString();
+ return WideString();
pBuff.resize(nActualLen);
- return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff));
+ return WideString::FromLocal(ByteStringView(pBuff));
}
void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData,
@@ -152,7 +152,7 @@ void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData,
!m_pInfo->m_pJsPlatform->Doc_submitForm) {
return;
}
- CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode();
+ ByteString bsDestination = WideString(URL).UTF16LE_Encode();
m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData,
length,
AsFPDFWideString(&bsDestination));
@@ -170,11 +170,11 @@ void CPDFSDK_FormFillEnvironment::JS_docmailForm(void* mailData,
!m_pInfo->m_pJsPlatform->Doc_mail) {
return;
}
- CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode();
- CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode();
- CFX_ByteString bsCC = CFX_WideString(CC).UTF16LE_Encode();
- CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode();
- CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
+ ByteString bsTo = WideString(To).UTF16LE_Encode();
+ ByteString bsSubject = WideString(Subject).UTF16LE_Encode();
+ ByteString bsCC = WideString(CC).UTF16LE_Encode();
+ ByteString bsBcc = WideString(BCC).UTF16LE_Encode();
+ ByteString bsMsg = WideString(Msg).UTF16LE_Encode();
m_pInfo->m_pJsPlatform->Doc_mail(
m_pInfo->m_pJsPlatform, mailData, length, bUI, AsFPDFWideString(&bsTo),
AsFPDFWideString(&bsSubject), AsFPDFWideString(&bsCC),
@@ -350,30 +350,30 @@ void CPDFSDK_FormFillEnvironment::SetCurrentPage(CPDFXFA_Context* document,
m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage);
}
-CFX_WideString CPDFSDK_FormFillEnvironment::GetPlatform() {
+WideString CPDFSDK_FormFillEnvironment::GetPlatform() {
if (!m_pInfo || !m_pInfo->FFI_GetPlatform)
- return CFX_WideString();
+ return WideString();
int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, nullptr, 0);
if (nRequiredLen <= 0)
- return CFX_WideString();
+ return WideString();
std::vector<uint8_t> pBuff(nRequiredLen);
int nActualLen =
m_pInfo->FFI_GetPlatform(m_pInfo, pBuff.data(), nRequiredLen);
if (nActualLen <= 0 || nActualLen > nRequiredLen)
- return CFX_WideString();
+ return WideString();
- return CFX_WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
- nActualLen / sizeof(uint16_t));
+ return WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
+ nActualLen / sizeof(uint16_t));
}
void CPDFSDK_FormFillEnvironment::GotoURL(CPDFXFA_Context* document,
- const CFX_WideStringC& wsURL) {
+ const WideStringView& wsURL) {
if (!m_pInfo || !m_pInfo->FFI_GotoURL)
return;
- CFX_ByteString bsTo = CFX_WideString(wsURL).UTF16LE_Encode();
+ ByteString bsTo = WideString(wsURL).UTF16LE_Encode();
FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(wsURL.GetLength());
m_pInfo->FFI_GotoURL(m_pInfo, document, pTo);
bsTo.ReleaseBuffer(bsTo.GetStringLength());
@@ -446,7 +446,7 @@ CPDFSDK_FormFillEnvironment::DownloadFromURL(const wchar_t* url) {
if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL)
return nullptr;
- CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode();
+ ByteString bstrURL = WideString(url).UTF16LE_Encode();
FPDF_WIDESTRING wsURL =
(FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength());
@@ -454,7 +454,7 @@ CPDFSDK_FormFillEnvironment::DownloadFromURL(const wchar_t* url) {
return MakeSeekableStream(fileHandler);
}
-CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL(
+WideString CPDFSDK_FormFillEnvironment::PostRequestURL(
const wchar_t* wsURL,
const wchar_t* wsData,
const wchar_t* wsContentType,
@@ -463,21 +463,21 @@ CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL(
if (!m_pInfo || !m_pInfo->FFI_PostRequestURL)
return L"";
- CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode();
+ ByteString bsURL = WideString(wsURL).UTF16LE_Encode();
FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength());
- CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode();
+ ByteString bsData = WideString(wsData).UTF16LE_Encode();
FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength());
- CFX_ByteString bsContentType = CFX_WideString(wsContentType).UTF16LE_Encode();
+ ByteString bsContentType = WideString(wsContentType).UTF16LE_Encode();
FPDF_WIDESTRING contentType =
(FPDF_WIDESTRING)bsContentType.GetBuffer(bsContentType.GetLength());
- CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode();
+ ByteString bsEncode = WideString(wsEncode).UTF16LE_Encode();
FPDF_WIDESTRING encode =
(FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength());
- CFX_ByteString bsHeader = CFX_WideString(wsHeader).UTF16LE_Encode();
+ ByteString bsHeader = WideString(wsHeader).UTF16LE_Encode();
FPDF_WIDESTRING header =
(FPDF_WIDESTRING)bsHeader.GetBuffer(bsHeader.GetLength());
@@ -486,7 +486,7 @@ CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL(
m_pInfo->FFI_PostRequestURL(m_pInfo, URL, data, contentType, encode, header,
&response);
- CFX_WideString wsRet = CFX_WideString::FromUTF16LE(
+ WideString wsRet = WideString::FromUTF16LE(
(FPDF_WIDESTRING)response.str, response.len / sizeof(FPDF_WIDESTRING));
FPDF_BStr_Clear(&response);
@@ -499,35 +499,35 @@ FPDF_BOOL CPDFSDK_FormFillEnvironment::PutRequestURL(const wchar_t* wsURL,
if (!m_pInfo || !m_pInfo->FFI_PutRequestURL)
return false;
- CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode();
+ ByteString bsURL = WideString(wsURL).UTF16LE_Encode();
FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength());
- CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode();
+ ByteString bsData = WideString(wsData).UTF16LE_Encode();
FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength());
- CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode();
+ ByteString bsEncode = WideString(wsEncode).UTF16LE_Encode();
FPDF_WIDESTRING encode =
(FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength());
return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode);
}
-CFX_WideString CPDFSDK_FormFillEnvironment::GetLanguage() {
+WideString CPDFSDK_FormFillEnvironment::GetLanguage() {
if (!m_pInfo || !m_pInfo->FFI_GetLanguage)
- return CFX_WideString();
+ return WideString();
int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, nullptr, 0);
if (nRequiredLen <= 0)
- return CFX_WideString();
+ return WideString();
std::vector<uint8_t> pBuff(nRequiredLen);
int nActualLen =
m_pInfo->FFI_GetLanguage(m_pInfo, pBuff.data(), nRequiredLen);
if (nActualLen <= 0 || nActualLen > nRequiredLen)
- return CFX_WideString();
+ return WideString();
- return CFX_WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
- nActualLen / sizeof(uint16_t));
+ return WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
+ nActualLen / sizeof(uint16_t));
}
void CPDFSDK_FormFillEnvironment::PageEvent(int iPageCount,
@@ -583,7 +583,7 @@ void CPDFSDK_FormFillEnvironment::ProcJavascriptFun() {
CPDF_DocJSActions docJS(pPDFDoc);
int iCount = docJS.CountJSActions();
for (int i = 0; i < iCount; i++) {
- CFX_WideString csJSName;
+ WideString csJSName;
CPDF_Action jsAction = docJS.GetJSActionAndName(i, &csJSName);
GetActionHandler()->DoAction_JavaScript(jsAction, csJSName, this);
}
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index c9937405bb..9e3c92561b 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -133,10 +133,10 @@ class CPDFSDK_FormFillEnvironment
void SetCurrentPage(CPDFXFA_Context* document, int iCurPage);
// TODO(dsinclair): This should probably change to PDFium?
- CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); }
+ WideString FFI_GetAppName() const { return WideString(L"Acrobat"); }
- CFX_WideString GetPlatform();
- void GotoURL(CPDFXFA_Context* document, const CFX_WideStringC& wsURL);
+ WideString GetPlatform();
+ void GotoURL(CPDFXFA_Context* document, const WideStringView& wsURL);
void GetPageViewRect(CPDFXFA_Page* page, FS_RECTF& dstRect);
bool PopupMenu(CPDFXFA_Page* page,
FPDF_WIDGET hWidget,
@@ -157,15 +157,15 @@ class CPDFSDK_FormFillEnvironment
FPDF_WIDESTRING wsURL,
const char* mode);
CFX_RetainPtr<IFX_SeekableReadStream> DownloadFromURL(const wchar_t* url);
- CFX_WideString PostRequestURL(const wchar_t* wsURL,
- const wchar_t* wsData,
- const wchar_t* wsContentType,
- const wchar_t* wsEncode,
- const wchar_t* wsHeader);
+ WideString PostRequestURL(const wchar_t* wsURL,
+ const wchar_t* wsData,
+ const wchar_t* wsContentType,
+ const wchar_t* wsEncode,
+ const wchar_t* wsHeader);
FPDF_BOOL PutRequestURL(const wchar_t* wsURL,
const wchar_t* wsData,
const wchar_t* wsEncode);
- CFX_WideString GetLanguage();
+ WideString GetLanguage();
void PageEvent(int iPageCount, uint32_t dwEventType) const;
#else // PDF_ENABLE_XFA
@@ -184,8 +184,8 @@ class CPDFSDK_FormFillEnvironment
void* response,
int length);
void JS_appBeep(int nType);
- CFX_WideString JS_fieldBrowse();
- CFX_WideString JS_docGetFilePath();
+ WideString JS_fieldBrowse();
+ WideString JS_docGetFilePath();
void JS_docSubmitForm(void* formData, int length, const wchar_t* URL);
void JS_docmailForm(void* mailData,
int length,
@@ -206,7 +206,7 @@ class CPDFSDK_FormFillEnvironment
void JS_docgotoPage(int nPageNum);
bool IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; }
- CFX_ByteString GetAppName() const { return ""; }
+ ByteString GetAppName() const { return ""; }
CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); }
FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; }
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index b60529df5d..fd0dffadba 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -117,7 +117,7 @@ CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const {
}
void CPDFSDK_InterForm::GetWidgets(
- const CFX_WideString& sFieldName,
+ const WideString& sFieldName,
std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const {
for (int i = 0, sz = m_pInterForm->CountFields(sFieldName); i < sz; ++i) {
CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName);
@@ -250,17 +250,17 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) {
if (!action.GetDict())
continue;
- CFX_WideString csJS = action.GetJavaScript();
+ WideString csJS = action.GetJavaScript();
if (csJS.IsEmpty())
continue;
IJS_EventContext* pContext = pRuntime->NewEventContext();
- CFX_WideString sOldValue = pField->GetValue();
- CFX_WideString sValue = sOldValue;
+ WideString sOldValue = pField->GetValue();
+ WideString sValue = sOldValue;
bool bRC = true;
pContext->OnField_Calculate(pFormField, pField, sValue, bRC);
- CFX_WideString sInfo;
+ WideString sInfo;
bool bRet = pContext->RunScript(csJS, &sInfo);
pRuntime->ReleaseEventContext(pContext);
if (bRet && bRC && sValue.Compare(sOldValue) != 0)
@@ -269,9 +269,9 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) {
m_bBusy = false;
}
-CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField,
- bool& bFormatted) {
- CFX_WideString sValue = pFormField->GetValue();
+WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField,
+ bool& bFormatted) {
+ WideString sValue = pFormField->GetValue();
if (!m_pFormFillEnv->IsJSInitiated()) {
bFormatted = false;
return sValue;
@@ -291,13 +291,13 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField,
if (aAction.GetDict() && aAction.ActionExist(CPDF_AAction::Format)) {
CPDF_Action action = aAction.GetAction(CPDF_AAction::Format);
if (action.GetDict()) {
- CFX_WideString script = action.GetJavaScript();
+ WideString script = action.GetJavaScript();
if (!script.IsEmpty()) {
- CFX_WideString Value = sValue;
+ WideString Value = sValue;
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnField_Format(pFormField, Value, true);
- CFX_WideString sInfo;
+ WideString sInfo;
bool bRet = pContext->RunScript(script, &sInfo);
pRuntime->ReleaseEventContext(pContext);
if (bRet) {
@@ -311,7 +311,7 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField,
}
void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField,
- const CFX_WideString* sValue,
+ const WideString* sValue,
bool bValueChanged) {
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
@@ -339,7 +339,7 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) {
}
bool CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField,
- const CFX_WideString& csValue) {
+ const WideString& csValue) {
CPDF_AAction aAction = pFormField->GetAdditionalAction();
if (!aAction.GetDict() || !aAction.ActionExist(CPDF_AAction::KeyStroke))
return true;
@@ -359,7 +359,7 @@ bool CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField,
}
bool CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField,
- const CFX_WideString& csValue) {
+ const WideString& csValue) {
CPDF_AAction aAction = pFormField->GetAdditionalAction();
if (!aAction.GetDict() || !aAction.ActionExist(CPDF_AAction::Validate))
return true;
@@ -412,7 +412,7 @@ bool CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) {
}
bool CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) {
- CFX_WideString sDestination = action.GetFilePath();
+ WideString sDestination = action.GetFilePath();
if (sDestination.IsEmpty())
return false;
@@ -436,11 +436,11 @@ bool CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) {
return SubmitForm(sDestination, false);
}
-bool CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination,
+bool CPDFSDK_InterForm::SubmitFields(const WideString& csDestination,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bUrlEncoded) {
- CFX_ByteString textBuf = ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude);
+ ByteString textBuf = ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude);
FX_STRSIZE nBufSize = textBuf.GetLength();
if (nBufSize == 0)
@@ -485,12 +485,12 @@ bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf,
CPDF_Dictionary* pField = pFields->GetDictAt(i);
if (!pField)
continue;
- CFX_WideString name;
+ WideString name;
name = pField->GetUnicodeTextFor("T");
- CFX_ByteString name_b = CFX_ByteString::FromUnicode(name);
- CFX_ByteString csBValue = pField->GetStringFor("V");
- CFX_WideString csWValue = PDF_DecodeText(csBValue);
- CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue);
+ ByteString name_b = ByteString::FromUnicode(name);
+ ByteString csBValue = pField->GetStringFor("V");
+ WideString csWValue = PDF_DecodeText(csBValue);
+ ByteString csValue_b = ByteString::FromUnicode(csWValue);
fdfEncodedData << name_b.GetBuffer(name_b.GetLength());
name_b.ReleaseBuffer(name_b.GetStringLength());
@@ -510,21 +510,20 @@ bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf,
return true;
}
-CFX_ByteString CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
+ByteString CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude) {
std::unique_ptr<CFDF_Document> pFDF = m_pInterForm->ExportToFDF(
m_pFormFillEnv->JS_docGetFilePath(), fields, bIncludeOrExclude, false);
- return pFDF ? pFDF->WriteToString() : CFX_ByteString();
+ return pFDF ? pFDF->WriteToString() : ByteString();
}
-CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName(
- const CFX_WideString& sFileExt) {
+WideString CPDFSDK_InterForm::GetTemporaryFileName(const WideString& sFileExt) {
return L"";
}
-bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination,
+bool CPDFSDK_InterForm::SubmitForm(const WideString& sDestination,
bool bUrlEncoded) {
if (sDestination.IsEmpty())
return false;
@@ -537,7 +536,7 @@ bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination,
if (!pFDFDoc)
return false;
- CFX_ByteString fdfBuffer = pFDFDoc->WriteToString();
+ ByteString fdfBuffer = pFDFDoc->WriteToString();
FX_STRSIZE nBufSize = fdfBuffer.GetLength();
if (nBufSize == 0)
@@ -562,11 +561,11 @@ bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination,
return true;
}
-CFX_ByteString CPDFSDK_InterForm::ExportFormToFDFTextBuf() {
+ByteString CPDFSDK_InterForm::ExportFormToFDFTextBuf() {
std::unique_ptr<CFDF_Document> pFDF =
m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath(), false);
- return pFDF ? pFDF->WriteToString() : CFX_ByteString();
+ return pFDF ? pFDF->WriteToString() : ByteString();
}
bool CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) {
@@ -593,7 +592,7 @@ std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects(
std::vector<CPDF_FormField*> fields;
for (CPDF_Object* pObject : objects) {
if (pObject && pObject->IsString()) {
- CFX_WideString csName = pObject->GetUnicodeText();
+ WideString csName = pObject->GetUnicodeText();
CPDF_FormField* pField = m_pInterForm->GetField(0, csName);
if (pField)
fields.push_back(pField);
@@ -603,7 +602,7 @@ std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects(
}
int CPDFSDK_InterForm::BeforeValueChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) {
+ const WideString& csValue) {
int nType = pField->GetFieldType();
if (nType != FIELDTYPE_COMBOBOX && nType != FIELDTYPE_TEXTFIELD)
return 0;
@@ -625,14 +624,14 @@ void CPDFSDK_InterForm::AfterValueChange(CPDF_FormField* pField) {
if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) {
OnCalculate(pField);
bool bFormatted = false;
- CFX_WideString sValue = OnFormat(pField, bFormatted);
+ WideString sValue = OnFormat(pField, bFormatted);
ResetFieldAppearance(pField, bFormatted ? &sValue : nullptr, true);
UpdateField(pField);
}
}
int CPDFSDK_InterForm::BeforeSelectionChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) {
+ const WideString& csValue) {
if (pField->GetFieldType() != FIELDTYPE_LISTBOX)
return 0;
diff --git a/fpdfsdk/cpdfsdk_interform.h b/fpdfsdk/cpdfsdk_interform.h
index b031345158..e14589ec59 100644
--- a/fpdfsdk/cpdfsdk_interform.h
+++ b/fpdfsdk/cpdfsdk_interform.h
@@ -43,7 +43,7 @@ class CPDFSDK_InterForm : public IPDF_FormNotify {
CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, bool bNext) const;
CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const;
- void GetWidgets(const CFX_WideString& sFieldName,
+ void GetWidgets(const WideString& sFieldName,
std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const;
void GetWidgets(CPDF_FormField* pField,
std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const;
@@ -65,14 +65,13 @@ class CPDFSDK_InterForm : public IPDF_FormNotify {
void SynchronizeField(CPDF_FormField* pFormField, bool bSynchronizeElse);
#endif // PDF_ENABLE_XFA
- bool OnKeyStrokeCommit(CPDF_FormField* pFormField,
- const CFX_WideString& csValue);
- bool OnValidate(CPDF_FormField* pFormField, const CFX_WideString& csValue);
+ bool OnKeyStrokeCommit(CPDF_FormField* pFormField, const WideString& csValue);
+ bool OnValidate(CPDF_FormField* pFormField, const WideString& csValue);
void OnCalculate(CPDF_FormField* pFormField = nullptr);
- CFX_WideString OnFormat(CPDF_FormField* pFormField, bool& bFormatted);
+ WideString OnFormat(CPDF_FormField* pFormField, bool& bFormatted);
void ResetFieldAppearance(CPDF_FormField* pFormField,
- const CFX_WideString* sValue,
+ const WideString* sValue,
bool bValueChanged);
void UpdateField(CPDF_FormField* pFormField);
@@ -84,16 +83,16 @@ class CPDFSDK_InterForm : public IPDF_FormNotify {
std::vector<CPDF_FormField*> GetFieldFromObjects(
const std::vector<CPDF_Object*>& objects) const;
bool IsValidField(CPDF_Dictionary* pFieldDict);
- bool SubmitFields(const CFX_WideString& csDestination,
+ bool SubmitFields(const WideString& csDestination,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bUrlEncoded);
- bool SubmitForm(const CFX_WideString& sDestination, bool bUrlEncoded);
- CFX_ByteString ExportFormToFDFTextBuf();
- CFX_ByteString ExportFieldsToFDFTextBuf(
+ bool SubmitForm(const WideString& sDestination, bool bUrlEncoded);
+ ByteString ExportFormToFDFTextBuf();
+ ByteString ExportFieldsToFDFTextBuf(
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude);
- CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt);
+ WideString GetTemporaryFileName(const WideString& sFileExt);
bool IsNeedHighLight(int nFieldType);
void RemoveAllHighLight();
@@ -105,10 +104,10 @@ class CPDFSDK_InterForm : public IPDF_FormNotify {
private:
// IPDF_FormNotify:
int BeforeValueChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) override;
+ const WideString& csValue) override;
void AfterValueChange(CPDF_FormField* pField) override;
int BeforeSelectionChange(CPDF_FormField* pField,
- const CFX_WideString& csValue) override;
+ const WideString& csValue) override;
void AfterSelectionChange(CPDF_FormField* pField) override;
void AfterCheckedStatusChange(CPDF_FormField* pField) override;
int BeforeFormReset(CPDF_InterForm* pForm) override;
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 5bdd720596..f22d575150 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -241,17 +241,17 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(CXFA_FFWidget* hWidget) {
}
#endif // PDF_ENABLE_XFA
-CFX_WideString CPDFSDK_PageView::GetSelectedText() {
+WideString CPDFSDK_PageView::GetSelectedText() {
if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) {
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
m_pFormFillEnv->GetAnnotHandlerMgr();
return pAnnotHandlerMgr->Annot_GetSelectedText(pAnnot);
}
- return CFX_WideString();
+ return WideString();
}
-void CPDFSDK_PageView::ReplaceSelection(const CFX_WideString& text) {
+void CPDFSDK_PageView::ReplaceSelection(const WideString& text) {
if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) {
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
m_pFormFillEnv->GetAnnotHandlerMgr();
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index 00e90d73e8..b86f30512f 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -61,8 +61,8 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
return m_pFormFillEnv.Get();
}
- CFX_WideString GetSelectedText();
- void ReplaceSelection(const CFX_WideString& text);
+ WideString GetSelectedText();
+ void ReplaceSelection(const WideString& text);
bool OnFocus(const CFX_PointF& point, uint32_t nFlag);
bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag);
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 0183f587cf..a859dcd374 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -75,7 +75,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
if (pContext->GetDocType() == XFA_DocType::Static) {
if (!m_hMixXFAWidget) {
if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) {
- CFX_WideString sName;
+ WideString sName;
if (GetFieldType() == FIELDTYPE_RADIOBUTTON) {
sName = GetAnnotName();
if (sName.IsEmpty())
@@ -102,7 +102,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
if (!pDocView)
return nullptr;
- CFX_WideString sName = GetName();
+ WideString sName = GetName();
return !sName.IsEmpty() ? pDocView->GetWidgetByName(sName, nullptr) : nullptr;
}
@@ -377,7 +377,7 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView,
}
case FIELDTYPE_TEXTFIELD: {
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
- CFX_WideString sValue;
+ WideString sValue;
pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display);
pFormField->SetValue(sValue, true);
}
@@ -409,7 +409,7 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView,
}
}
- CFX_WideString sValue;
+ WideString sValue;
pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display);
pFormField->SetValue(sValue, true);
}
@@ -432,7 +432,7 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView,
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(false); i < sz;
i++) {
- CFX_WideString swText;
+ WideString swText;
pWidgetAcc->GetChoiceListItem(swText, i, false);
pFormField->InsertOption(swText, i, true);
@@ -447,7 +447,7 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView,
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(false); i < sz;
i++) {
- CFX_WideString swText;
+ WideString swText;
pWidgetAcc->GetChoiceListItem(swText, i, false);
pFormField->InsertOption(swText, i, false);
@@ -552,7 +552,7 @@ int CPDFSDK_Widget::GetRotate() const {
}
#ifdef PDF_ENABLE_XFA
-CFX_WideString CPDFSDK_Widget::GetName() const {
+WideString CPDFSDK_Widget::GetName() const {
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetFullName();
}
@@ -607,28 +607,28 @@ int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const {
}
#ifdef PDF_ENABLE_XFA
-CFX_WideString CPDFSDK_Widget::GetValue(bool bDisplay) const {
+WideString CPDFSDK_Widget::GetValue(bool bDisplay) const {
if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) {
if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) {
- CFX_WideString sValue;
+ WideString sValue;
pWidgetAcc->GetValue(
sValue, bDisplay ? XFA_VALUEPICTURE_Display : XFA_VALUEPICTURE_Edit);
return sValue;
}
}
#else
-CFX_WideString CPDFSDK_Widget::GetValue() const {
+WideString CPDFSDK_Widget::GetValue() const {
#endif // PDF_ENABLE_XFA
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetValue();
}
-CFX_WideString CPDFSDK_Widget::GetDefaultValue() const {
+WideString CPDFSDK_Widget::GetDefaultValue() const {
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetDefaultValue();
}
-CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const {
+WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const {
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetOptionLabel(nIndex);
}
@@ -692,7 +692,7 @@ void CPDFSDK_Widget::SetCheck(bool bChecked, bool bNotify) {
#endif // PDF_ENABLE_XFA
}
-void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, bool bNotify) {
+void CPDFSDK_Widget::SetValue(const WideString& sValue, bool bNotify) {
CPDF_FormField* pFormField = GetFormField();
pFormField->SetValue(sValue, bNotify);
#ifdef PDF_ENABLE_XFA
@@ -701,7 +701,7 @@ void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, bool bNotify) {
#endif // PDF_ENABLE_XFA
}
-void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) {}
+void CPDFSDK_Widget::SetDefaultValue(const WideString& sValue) {}
void CPDFSDK_Widget::SetOptionSelection(int index,
bool bSelected,
bool bNotify) {
@@ -742,7 +742,7 @@ void CPDFSDK_Widget::ResetAppearance(bool bValueChanged) {
case FIELDTYPE_TEXTFIELD:
case FIELDTYPE_COMBOBOX: {
bool bFormatted = false;
- CFX_WideString sValue = OnFormat(bFormatted);
+ WideString sValue = OnFormat(bFormatted);
ResetAppearance(bFormatted ? &sValue : nullptr, true);
break;
}
@@ -753,7 +753,7 @@ void CPDFSDK_Widget::ResetAppearance(bool bValueChanged) {
}
#endif // PDF_ENABLE_XFA
-void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue,
+void CPDFSDK_Widget::ResetAppearance(const WideString* sValue,
bool bValueChanged) {
SetAppModified();
@@ -786,7 +786,7 @@ void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue,
m_pAnnot->ClearCachedAP();
}
-CFX_WideString CPDFSDK_Widget::OnFormat(bool& bFormatted) {
+WideString CPDFSDK_Widget::OnFormat(bool& bFormatted) {
CPDF_FormField* pFormField = GetFormField();
ASSERT(pFormField);
return m_pInterForm->OnFormat(pFormField, bFormatted);
@@ -1042,7 +1042,7 @@ CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) {
return CPDF_Action();
}
-CFX_WideString CPDFSDK_Widget::GetAlternateName() const {
+WideString CPDFSDK_Widget::GetAlternateName() const {
CPDF_FormField* pFormField = GetFormField();
return pFormField->GetAlternateName();
}
diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h
index d33413afae..5b2411e170 100644
--- a/fpdfsdk/cpdfsdk_widget.h
+++ b/fpdfsdk/cpdfsdk_widget.h
@@ -82,12 +82,12 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
int GetSelectedIndex(int nIndex) const;
#ifndef PDF_ENABLE_XFA
- CFX_WideString GetValue() const;
+ WideString GetValue() const;
#else
- CFX_WideString GetValue(bool bDisplay = true) const;
+ WideString GetValue(bool bDisplay = true) const;
#endif // PDF_ENABLE_XFA
- CFX_WideString GetDefaultValue() const;
- CFX_WideString GetOptionLabel(int nIndex) const;
+ WideString GetDefaultValue() const;
+ WideString GetOptionLabel(int nIndex) const;
int CountOptions() const;
bool IsOptionSelected(int nIndex) const;
int GetTopVisibleIndex() const;
@@ -95,13 +95,13 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
int GetAlignment() const;
int GetMaxLen() const;
#ifdef PDF_ENABLE_XFA
- CFX_WideString GetName() const;
+ WideString GetName() const;
#endif // PDF_ENABLE_XFA
- CFX_WideString GetAlternateName() const;
+ WideString GetAlternateName() const;
void SetCheck(bool bChecked, bool bNotify);
- void SetValue(const CFX_WideString& sValue, bool bNotify);
- void SetDefaultValue(const CFX_WideString& sValue);
+ void SetValue(const WideString& sValue, bool bNotify);
+ void SetDefaultValue(const WideString& sValue);
void SetOptionSelection(int index, bool bSelected, bool bNotify);
void ClearSelection(bool bNotify);
void SetTopVisibleIndex(int index);
@@ -109,10 +109,10 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
#ifdef PDF_ENABLE_XFA
void ResetAppearance(bool bValueChanged);
#endif // PDF_ENABLE_XFA
- void ResetAppearance(const CFX_WideString* sValue, bool bValueChanged);
+ void ResetAppearance(const WideString* sValue, bool bValueChanged);
void ResetFieldAppearance(bool bValueChanged);
void UpdateField();
- CFX_WideString OnFormat(bool& bFormatted);
+ WideString OnFormat(bool& bFormatted);
bool OnAAction(CPDF_AAction::AActionType type,
PDFSDK_FieldAction& data,
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index d20d29af67..ab37141ba2 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -231,7 +231,7 @@ void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
bool bFormatted = false;
CPDFSDK_Annot::ObservedPtr pObserved(pWidget);
- CFX_WideString sValue = pWidget->OnFormat(bFormatted);
+ WideString sValue = pWidget->OnFormat(bFormatted);
if (!pObserved)
return;
@@ -280,15 +280,15 @@ CFX_FloatRect CPDFSDK_WidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
return CFX_FloatRect();
}
-CFX_WideString CPDFSDK_WidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
+WideString CPDFSDK_WidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->GetSelectedText(pAnnot);
- return CFX_WideString();
+ return WideString();
}
void CPDFSDK_WidgetHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {
+ const WideString& text) {
if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
m_pFormFiller->ReplaceSelection(pAnnot, text);
}
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h
index 82a9380ced..d83c98f255 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -37,9 +37,8 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) override;
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
- void ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) override;
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override;
bool HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
const CFX_PointF& point) override;
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index e9c99721b7..b5c52a89cc 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -99,15 +99,14 @@ CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
// TODO(bug 840): Implement so selected text can be obtained from XFA
// fields.
-CFX_WideString CPDFSDK_XFAWidgetHandler::GetSelectedText(
- CPDFSDK_Annot* pAnnot) {
- return CFX_WideString();
+WideString CPDFSDK_XFAWidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) {
+ return WideString();
}
// TODO(bug 840): Implement so text can be inserted into and deleted from XFA
// fields.
void CPDFSDK_XFAWidgetHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {}
+ const WideString& text) {}
bool CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.h b/fpdfsdk/cpdfsdk_xfawidgethandler.h
index e1f7661cf6..e26472d69c 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.h
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.h
@@ -32,9 +32,8 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler {
void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) override;
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
- void ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) override;
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override;
bool HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
const CFX_PointF& point) override;
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index c3ab2b8f56..625ce469c7 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -68,7 +68,7 @@ void CBA_FontMap::Initialize() {
}
void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
- const CFX_ByteString& sFontName) {
+ const ByteString& sFontName) {
ASSERT(pFont);
if (m_pDefaultFont)
@@ -83,7 +83,7 @@ void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
AddFontData(m_pDefaultFont.Get(), m_sDefaultFontName, nCharset);
}
-CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias,
+CPDF_Font* CBA_FontMap::FindFontSameCharset(ByteString* sFontAlias,
int32_t nCharset) {
if (m_pAnnotDict->GetStringFor("Subtype") != "Widget")
return nullptr;
@@ -109,7 +109,7 @@ CPDF_Document* CBA_FontMap::GetDocument() {
}
CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
- CFX_ByteString* sFontAlias,
+ ByteString* sFontAlias,
int32_t nCharset) {
if (!pResDict)
return nullptr;
@@ -121,7 +121,7 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
CPDF_Document* pDocument = GetDocument();
CPDF_Font* pFind = nullptr;
for (const auto& it : *pFonts) {
- const CFX_ByteString& csKey = it.first;
+ const ByteString& csKey = it.first;
if (!it.second)
continue;
@@ -145,13 +145,12 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
return pFind;
}
-void CBA_FontMap::AddedFont(CPDF_Font* pFont,
- const CFX_ByteString& sFontAlias) {
+void CBA_FontMap::AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) {
AddFontToAnnotDict(pFont, sFontAlias);
}
void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
- const CFX_ByteString& sAlias) {
+ const ByteString& sAlias) {
if (!pFont)
return;
@@ -194,7 +193,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
}
}
-CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) {
+CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(ByteString* sAlias) {
CPDF_Dictionary* pAcroFormDict = nullptr;
const bool bWidget = (m_pAnnotDict->GetStringFor("Subtype") == "Widget");
if (bWidget) {
@@ -203,7 +202,7 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) {
pAcroFormDict = pRootDict->GetDictFor("AcroForm");
}
- CFX_ByteString sDA;
+ ByteString sDA;
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pAnnotDict.Get(), "DA");
if (pObj)
sDA = pObj->GetString();
@@ -211,17 +210,17 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) {
if (bWidget) {
if (sDA.IsEmpty()) {
pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA");
- sDA = pObj ? pObj->GetString() : CFX_ByteString();
+ sDA = pObj ? pObj->GetString() : ByteString();
}
}
if (sDA.IsEmpty())
return nullptr;
- CPDF_SimpleParser syntax(sDA.AsStringC());
+ CPDF_SimpleParser syntax(sDA.AsStringView());
syntax.FindTagParamFromStart("Tf", 2);
- CFX_ByteString sFontName(syntax.GetWord());
- CFX_ByteString sDecodedFontName = PDF_NameDecode(sFontName);
+ ByteString sFontName(syntax.GetWord());
+ ByteString sDecodedFontName = PDF_NameDecode(sFontName);
*sAlias = sDecodedFontName.Right(sDecodedFontName.GetLength() - 1);
CPDF_Dictionary* pFontDict = nullptr;
@@ -243,7 +242,7 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) {
return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
}
-void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) {
+void CBA_FontMap::SetAPType(const ByteString& sAPType) {
m_sAPType = sAPType;
Reset();
diff --git a/fpdfsdk/formfiller/cba_fontmap.h b/fpdfsdk/formfiller/cba_fontmap.h
index 7eb7d4e19c..807cb65f4f 100644
--- a/fpdfsdk/formfiller/cba_fontmap.h
+++ b/fpdfsdk/formfiller/cba_fontmap.h
@@ -19,28 +19,28 @@ class CBA_FontMap : public CPWL_FontMap {
~CBA_FontMap() override;
void Reset();
- void SetDefaultFont(CPDF_Font* pFont, const CFX_ByteString& sFontName);
- void SetAPType(const CFX_ByteString& sAPType);
+ void SetDefaultFont(CPDF_Font* pFont, const ByteString& sFontName);
+ void SetAPType(const ByteString& sAPType);
private:
// CPWL_FontMap:
void Initialize() override;
CPDF_Document* GetDocument() override;
- CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias,
+ CPDF_Font* FindFontSameCharset(ByteString* sFontAlias,
int32_t nCharset) override;
- void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias) override;
+ void AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) override;
CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict,
- CFX_ByteString* sFontAlias,
+ ByteString* sFontAlias,
int32_t nCharset);
- CPDF_Font* GetAnnotDefaultFont(CFX_ByteString* csNameTag);
- void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
+ CPDF_Font* GetAnnotDefaultFont(ByteString* csNameTag);
+ void AddFontToAnnotDict(CPDF_Font* pFont, const ByteString& sAlias);
CFX_UnownedPtr<CPDF_Document> m_pDocument;
CFX_UnownedPtr<CPDF_Dictionary> m_pAnnotDict;
CFX_UnownedPtr<CPDF_Font> m_pDefaultFont;
- CFX_ByteString m_sDefaultFontName;
- CFX_ByteString m_sAPType;
+ ByteString m_sDefaultFontName;
+ ByteString m_sAPType;
};
#endif // FPDFSDK_FORMFILLER_CBA_FONTMAP_H_
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index aeb31f5b88..ab34a650c5 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -52,7 +52,7 @@ CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) {
pWnd->SetFillerNotify(pFormFiller);
int32_t nCurSel = m_pWidget->GetSelectedIndex(0);
- CFX_WideString swText;
+ WideString swText;
if (nCurSel < 0)
swText = m_pWidget->GetValue();
else
@@ -94,7 +94,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) {
if (!pWnd)
return;
- CFX_WideString swText = pWnd->GetText();
+ WideString swText = pWnd->GetText();
int32_t nCurSel = pWnd->GetSelect();
bool bSetValue = false;
@@ -235,15 +235,15 @@ void CFFL_ComboBox::OnSetFocus(CPWL_Edit* pEdit) {
pEdit->SetCharSet(FX_CHARSET_ChineseSimplified);
pEdit->SetReadyToInput();
- CFX_WideString wsText = pEdit->GetText();
+ WideString wsText = pEdit->GetText();
int nCharacters = wsText.GetLength();
- CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
+ ByteString bsUTFText = wsText.UTF16LE_Encode();
auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}
-CFX_WideString CFFL_ComboBox::GetSelectExportText() {
- CFX_WideString swRet;
+WideString CFFL_ComboBox::GetSelectExportText() {
+ WideString swRet;
int nExport = -1;
CPDFSDK_PageView* pPageView = GetCurPageView(true);
diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h
index dc8441d1cd..bdc0934862 100644
--- a/fpdfsdk/formfiller/cffl_combobox.h
+++ b/fpdfsdk/formfiller/cffl_combobox.h
@@ -16,7 +16,7 @@ struct FFL_ComboBoxState {
int nIndex;
int nStart;
int nEnd;
- CFX_WideString sValue;
+ WideString sValue;
};
class CFFL_ComboBox : public CFFL_TextObject,
@@ -50,7 +50,7 @@ class CFFL_ComboBox : public CFFL_TextObject,
void OnSetFocus(CPWL_Edit* pEdit) override;
private:
- CFX_WideString GetSelectExportText();
+ WideString GetSelectExportText();
FFL_ComboBoxState m_State;
};
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index fd569c7201..2c6138b92b 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -233,19 +233,19 @@ bool CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot,
return pWnd && pWnd->OnChar(nChar, nFlags);
}
-CFX_WideString CFFL_FormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) {
+WideString CFFL_FormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) {
if (!IsValid())
- return CFX_WideString();
+ return WideString();
CPDFSDK_PageView* pPageView = GetCurPageView(true);
ASSERT(pPageView);
CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false);
- return pWnd ? pWnd->GetSelectedText() : CFX_WideString();
+ return pWnd ? pWnd->GetSelectedText() : WideString();
}
void CFFL_FormFiller::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {
+ const WideString& text) {
if (!IsValid())
return;
diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h
index e9c2c551d2..8078d35519 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.h
+++ b/fpdfsdk/formfiller/cffl_formfiller.h
@@ -75,8 +75,8 @@ class CFFL_FormFiller : public CPWL_Wnd::ProviderIface,
uint32_t nFlags);
virtual bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags);
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
- void ReplaceSelection(CPDFSDK_Annot* pAnnot, const CFX_WideString& text);
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text);
void SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag);
void KillFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag);
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 989539fad3..3625e9db38 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -516,15 +516,14 @@ void CFFL_InteractiveFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) {
UnRegisterFormFiller(pAnnot);
}
-CFX_WideString CFFL_InteractiveFormFiller::GetSelectedText(
- CPDFSDK_Annot* pAnnot) {
+WideString CFFL_InteractiveFormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) {
ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false);
- return pFormFiller ? pFormFiller->GetSelectedText(pAnnot) : CFX_WideString();
+ return pFormFiller ? pFormFiller->GetSelectedText(pAnnot) : WideString();
}
void CFFL_InteractiveFormFiller::ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) {
+ const WideString& text) {
ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false);
if (!pFormFiller)
@@ -690,8 +689,7 @@ void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot,
CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm();
bool bFormatted = false;
- CFX_WideString sValue =
- pInterForm->OnFormat(pWidget->GetFormField(), bFormatted);
+ WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bFormatted);
if (!(*pAnnot))
return;
@@ -857,8 +855,8 @@ bool CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView,
std::pair<bool, bool> CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
CPWL_Wnd::PrivateData* pAttached,
- CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ WideString& strChange,
+ const WideString& strChangeEx,
int nSelStart,
int nSelEnd,
bool bKeyDown,
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 0982f1d92b..553cbe8f1d 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -83,8 +83,8 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify {
CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, bool bRegister);
void RemoveFormFiller(CPDFSDK_Annot* pAnnot);
- CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
- void ReplaceSelection(CPDFSDK_Annot* pAnnot, const CFX_WideString& text);
+ WideString GetSelectedText(CPDFSDK_Annot* pAnnot);
+ void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text);
static bool IsVisible(CPDFSDK_Widget* pWidget);
static bool IsReadOnly(CPDFSDK_Widget* pWidget);
@@ -133,8 +133,8 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify {
float* fPopupRet) override;
// Returns {bRC, bExit}.
std::pair<bool, bool> OnBeforeKeyStroke(CPWL_Wnd::PrivateData* pAttached,
- CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ WideString& strChange,
+ const WideString& strChangeEx,
int nSelStart,
int nSelEnd,
bool bKeyDown,
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 8bf0825245..76434a5216 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -74,7 +74,7 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) {
pWnd->SetFillerNotify(m_pFormFillEnv->GetInteractiveFormFiller());
int32_t nMaxLen = m_pWidget->GetMaxLen();
- CFX_WideString swValue = m_pWidget->GetValue();
+ WideString swValue = m_pWidget->GetValue();
if (nMaxLen > 0) {
if (pWnd->HasFlag(PES_CHARARRAY)) {
@@ -136,8 +136,8 @@ void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) {
if (!pWnd)
return;
- CFX_WideString sOldValue = m_pWidget->GetValue();
- CFX_WideString sNewValue = pWnd->GetText();
+ WideString sOldValue = m_pWidget->GetValue();
+ WideString sNewValue = pWnd->GetText();
m_pWidget->SetValue(sNewValue, false);
m_pWidget->ResetFieldAppearance(true);
@@ -239,9 +239,9 @@ void CFFL_TextField::OnSetFocus(CPWL_Edit* pEdit) {
pEdit->SetCharSet(FX_CHARSET_ChineseSimplified);
pEdit->SetReadyToInput();
- CFX_WideString wsText = pEdit->GetText();
+ WideString wsText = pEdit->GetText();
int nCharacters = wsText.GetLength();
- CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
+ ByteString bsUTFText = wsText.UTF16LE_Encode();
auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}
diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h
index 2a99413398..49ffc0fc33 100644
--- a/fpdfsdk/formfiller/cffl_textfield.h
+++ b/fpdfsdk/formfiller/cffl_textfield.h
@@ -21,7 +21,7 @@ struct FFL_TextFieldState {
int nStart;
int nEnd;
- CFX_WideString sValue;
+ WideString sValue;
};
class CFFL_TextField : public CFFL_TextObject,
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 676f701106..1e39f2b2c9 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -52,7 +52,7 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT);
} else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) {
const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
- CFX_ByteString cbString;
+ ByteString cbString;
if (pAnnotDict->KeyExist("IT"))
cbString = pAnnotDict->GetStringFor("IT");
if (cbString.Compare("Img") != 0)
@@ -67,7 +67,7 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT);
} else if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) {
const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
- CFX_ByteString cbString;
+ ByteString cbString;
if (pAnnotDict->KeyExist("FT"))
cbString = pAnnotDict->GetStringFor("FT");
if (cbString.Compare("Sig") == 0)
@@ -75,18 +75,18 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) {
}
}
-bool CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) {
+bool CheckSharedForm(const CXML_Element* pElement, ByteString cbName) {
int count = pElement->CountAttrs();
int i = 0;
for (i = 0; i < count; i++) {
- CFX_ByteString space;
- CFX_ByteString name;
- CFX_WideString value;
+ ByteString space;
+ ByteString name;
+ WideString value;
pElement->GetAttrByIndex(i, &space, &name, &value);
if (space == "xmlns" && name == "adhocwf" &&
value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") {
CXML_Element* pVersion =
- pElement->GetElement("adhocwf", cbName.AsStringC(), 0);
+ pElement->GetElement("adhocwf", cbName.AsStringView(), 0);
if (!pVersion)
continue;
CXML_Content* pContent = ToContent(pVersion->GetChild(0));
@@ -127,7 +127,7 @@ void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) {
// Portfolios and Packages
const CPDF_Dictionary* pRootDict = pDoc->GetRoot();
if (pRootDict) {
- CFX_ByteString cbString;
+ ByteString cbString;
if (pRootDict->KeyExist("Collection")) {
FPDF_UnSupportError(FPDF_UNSP_DOC_PORTABLECOLLECTION);
return;
@@ -143,7 +143,7 @@ void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) {
CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayFor("Names") : nullptr;
if (pArray) {
for (size_t i = 0; i < pArray->GetCount(); i++) {
- CFX_ByteString cbStr = pArray->GetStringAt(i);
+ ByteString cbStr = pArray->GetStringAt(i);
if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) {
FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW);
return;
@@ -181,7 +181,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFDoc_GetPageMode(FPDF_DOCUMENT document) {
if (!pName)
return PAGEMODE_USENONE;
- CFX_ByteString strPageMode = pName->GetString();
+ ByteString strPageMode = pName->GetString();
if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone"))
return PAGEMODE_USENONE;
if (strPageMode.EqualNoCase("UseOutlines"))
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index b8e84c8cc4..a276e3a368 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -97,7 +97,7 @@ int ParserAnnots(CPDF_Document* pSourceDoc,
if (!pAnnotDic)
continue;
- CFX_ByteString sSubtype = pAnnotDic->GetStringFor("Subtype");
+ ByteString sSubtype = pAnnotDic->GetStringFor("Subtype");
if (sSubtype == "Popup")
continue;
@@ -168,18 +168,18 @@ CFX_FloatRect CalculateRect(std::vector<CFX_FloatRect>* pRectArray) {
return rcRet;
}
-uint32_t NewIndirectContentsStream(const CFX_ByteString& key,
+uint32_t NewIndirectContentsStream(const ByteString& key,
CPDF_Document* pDocument) {
CPDF_Stream* pNewContents = pDocument->NewIndirect<CPDF_Stream>(
nullptr, 0,
pdfium::MakeUnique<CPDF_Dictionary>(pDocument->GetByteStringPool()));
- CFX_ByteString sStream;
+ ByteString sStream;
sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
pNewContents->SetData(sStream.raw_str(), sStream.GetLength());
return pNewContents->GetObjNum();
}
-void SetPageContents(const CFX_ByteString& key,
+void SetPageContents(const ByteString& key,
CPDF_Dictionary* pPage,
CPDF_Document* pDocument) {
CPDF_Array* pContentsArray = nullptr;
@@ -199,9 +199,9 @@ void SetPageContents(const CFX_ByteString& key,
pContentsArray = pDocument->NewIndirect<CPDF_Array>();
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pContentsStream);
pAcc->LoadAllData();
- CFX_ByteString sStream = "q\n";
- CFX_ByteString sBody =
- CFX_ByteString((const char*)pAcc->GetData(), pAcc->GetSize());
+ ByteString sStream = "q\n";
+ ByteString sBody =
+ ByteString((const char*)pAcc->GetData(), pAcc->GetSize());
sStream = sStream + sBody + "\nQ";
pContentsStream->SetDataAndRemoveFilter(sStream.raw_str(),
sStream.GetLength());
@@ -299,10 +299,10 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
if (!pPageXObject)
pPageXObject = pRes->SetNewFor<CPDF_Dictionary>("XObject");
- CFX_ByteString key;
+ ByteString key;
int nStreams = pdfium::CollectionSize<int>(ObjectArray);
if (nStreams > 0) {
- CFX_ByteString sKey;
+ ByteString sKey;
int i = 0;
while (i < INT_MAX) {
sKey.Format("FFT%d", i);
@@ -336,7 +336,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CFX_FloatRect rcAnnot = pAnnotDic->GetRectFor("Rect");
rcAnnot.Normalize();
- CFX_ByteString sAnnotState = pAnnotDic->GetStringFor("AS");
+ ByteString sAnnotState = pAnnotDic->GetStringFor("AS");
CPDF_Dictionary* pAnnotAP = pAnnotDic->GetDictFor("AP");
if (!pAnnotAP)
continue;
@@ -392,17 +392,17 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
if (!pXObject)
pXObject = pNewXORes->SetNewFor<CPDF_Dictionary>("XObject");
- CFX_ByteString sFormName;
+ ByteString sFormName;
sFormName.Format("F%d", i);
pXObject->SetNewFor<CPDF_Reference>(sFormName, pDocument,
pObj->GetObjNum());
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pNewXObject);
pAcc->LoadAllData();
- CFX_ByteString sStream(pAcc->GetData(), pAcc->GetSize());
+ ByteString sStream(pAcc->GetData(), pAcc->GetSize());
CFX_Matrix matrix = pAPDic->GetMatrixFor("Matrix");
CFX_Matrix m = GetMatrix(rcAnnot, rcStream, matrix);
- CFX_ByteString sTemp;
+ ByteString sTemp;
sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f,
sFormName.c_str());
sStream += sTemp;
diff --git a/fpdfsdk/fpdf_structtree.cpp b/fpdfsdk/fpdf_structtree.cpp
index a6bf60d0df..b1fca65015 100644
--- a/fpdfsdk/fpdf_structtree.cpp
+++ b/fpdfsdk/fpdf_structtree.cpp
@@ -22,13 +22,13 @@ CPDF_StructElement* ToStructTreeElement(FPDF_STRUCTELEMENT struct_element) {
return static_cast<CPDF_StructElement*>(struct_element);
}
-unsigned long WideStringToBuffer(const CFX_WideString& str,
+unsigned long WideStringToBuffer(const WideString& str,
void* buffer,
unsigned long buflen) {
if (str.IsEmpty())
return 0;
- CFX_ByteString encodedStr = str.UTF16LE_Encode();
+ ByteString encodedStr = str.UTF16LE_Encode();
const unsigned long len = encodedStr.GetLength();
if (buffer && len <= buflen)
memcpy(buffer, encodedStr.c_str(), len);
diff --git a/fpdfsdk/fpdf_structtree_embeddertest.cpp b/fpdfsdk/fpdf_structtree_embeddertest.cpp
index 43a4d0159f..05b77fc0f7 100644
--- a/fpdfsdk/fpdf_structtree_embeddertest.cpp
+++ b/fpdfsdk/fpdf_structtree_embeddertest.cpp
@@ -57,8 +57,8 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) {
ASSERT_EQ(24U, FPDF_StructElement_GetAltText(gchild_element, buffer,
sizeof(buffer)));
const wchar_t kExpected[] = L"Black Image";
- EXPECT_EQ(CFX_WideString(kExpected),
- CFX_WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
+ EXPECT_EQ(WideString(kExpected),
+ WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
ASSERT_EQ(1, FPDF_StructElement_CountChildren(gchild_element));
FPDF_STRUCTELEMENT ggchild_element =
@@ -91,8 +91,8 @@ TEST_F(FPDFStructTreeEmbeddertest, GetType) {
ASSERT_EQ(18U, FPDF_StructElement_GetType(element, buffer, sizeof(buffer)));
const wchar_t kExpected[] = L"Document";
- EXPECT_EQ(CFX_WideString(kExpected),
- CFX_WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
+ EXPECT_EQ(WideString(kExpected),
+ WideString::FromUTF16LE(buffer, FXSYS_len(kExpected)));
FPDF_StructTree_Close(struct_tree);
FPDF_ClosePage(page);
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index 92c99373cf..875f3fd992 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -73,7 +73,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size);
}
- bool GetFaceName(void* hFont, CFX_ByteString* name) override {
+ bool GetFaceName(void* hFont, ByteString* name) override {
if (!m_pInfo->GetFaceName)
return false;
uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 0);
@@ -81,7 +81,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
return false;
char* buffer = FX_Alloc(char, size);
size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size);
- *name = CFX_ByteString(buffer, size);
+ *name = ByteString(buffer, size);
FX_Free(buffer);
return true;
}
@@ -167,7 +167,7 @@ static unsigned long DefaultGetFaceName(struct _FPDF_SYSFONTINFO* pThis,
void* hFont,
char* buffer,
unsigned long buf_size) {
- CFX_ByteString name;
+ ByteString name;
auto* pDefault = static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pThis);
if (!pDefault->m_pFontInfo->GetFaceName(hFont, &name))
return 0;
@@ -175,7 +175,7 @@ static unsigned long DefaultGetFaceName(struct _FPDF_SYSFONTINFO* pThis,
return name.GetLength() + 1;
strncpy(buffer, name.c_str(),
- (name.GetLength() + 1) * sizeof(CFX_ByteString::CharType));
+ (name.GetLength() + 1) * sizeof(ByteString::CharType));
return name.GetLength() + 1;
}
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 93df594618..94807718e1 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -25,7 +25,7 @@
namespace {
void SetBoundingBox(CPDF_Page* page,
- const CFX_ByteString& key,
+ const ByteString& key,
float left,
float bottom,
float right,
@@ -38,7 +38,7 @@ void SetBoundingBox(CPDF_Page* page,
}
bool GetBoundingBox(CPDF_Page* page,
- const CFX_ByteString& key,
+ const ByteString& key,
float* left,
float* bottom,
float* right,
@@ -111,12 +111,12 @@ FPDFPage_TransFormWithClip(FPDF_PAGE page,
CFX_FloatRect rect(clipRect->left, clipRect->bottom, clipRect->right,
clipRect->top);
rect.Normalize();
- CFX_ByteString bsClipping;
+ ByteString bsClipping;
bsClipping.Format("%f %f %f %f re W* n ", rect.left, rect.bottom,
rect.Width(), rect.Height());
textBuf << bsClipping;
- CFX_ByteString bsMatix;
+ ByteString bsMatix;
bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b, matrix->c,
matrix->d, matrix->e, matrix->f);
textBuf << bsMatix;
@@ -248,7 +248,7 @@ void OutputPath(std::ostringstream& buf, CPDF_Path path) {
return;
}
- CFX_ByteString temp;
+ ByteString temp;
for (size_t i = 0; i < pPoints.size(); i++) {
buf << pPoints[i].m_Point.x << " " << pPoints[i].m_Point.y;
FXPT_TYPE point_type = pPoints[i].m_Type;
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp
index 95f0f44af9..e08a3bf17f 100644
--- a/fpdfsdk/fpdfannot.cpp
+++ b/fpdfsdk/fpdfannot.cpp
@@ -483,7 +483,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetColor(FPDF_ANNOTATION annot,
pAnnotDict->SetNewFor<CPDF_Number>("CA", A / 255.f);
// Set the color of the annotation.
- CFX_ByteString key = type == FPDFANNOT_COLORTYPE_InteriorColor ? "IC" : "C";
+ ByteString key = type == FPDFANNOT_COLORTYPE_InteriorColor ? "IC" : "C";
CPDF_Array* pColor = pAnnotDict->GetArrayFor(key);
if (pColor)
pColor->Clear();
diff --git a/fpdfsdk/fpdfattachment.cpp b/fpdfsdk/fpdfattachment.cpp
index d984cf8910..7402114756 100644
--- a/fpdfsdk/fpdfattachment.cpp
+++ b/fpdfsdk/fpdfattachment.cpp
@@ -25,24 +25,23 @@ namespace {
constexpr char kChecksumKey[] = "CheckSum";
-CFX_ByteString CFXByteStringHexDecode(const CFX_ByteString& bsHex) {
+ByteString CFXByteStringHexDecode(const ByteString& bsHex) {
uint8_t* result = nullptr;
uint32_t size = 0;
HexDecode(bsHex.raw_str(), bsHex.GetLength(), &result, &size);
- CFX_ByteString bsDecoded(result, size);
+ ByteString bsDecoded(result, size);
FX_Free(result);
return bsDecoded;
}
-CFX_ByteString GenerateMD5Base16(const void* contents,
- const unsigned long len) {
+ByteString GenerateMD5Base16(const void* contents, const unsigned long len) {
uint8_t digest[16];
CRYPT_MD5Generate(reinterpret_cast<const uint8_t*>(contents), len, digest);
char buf[32];
for (int i = 0; i < 16; ++i)
FXSYS_IntToTwoHexChars(digest[i], &buf[i * 2]);
- return CFX_ByteString(buf, 32);
+ return ByteString(buf, 32);
}
} // namespace
@@ -59,8 +58,8 @@ FPDFDoc_GetAttachmentCount(FPDF_DOCUMENT document) {
FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV
FPDFDoc_AddAttachment(FPDF_DOCUMENT document, FPDF_WIDESTRING name) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- CFX_WideString wsName =
- CFX_WideString::FromUTF16LE(name, CFX_WideString::WStringLength(name));
+ WideString wsName =
+ WideString::FromUTF16LE(name, WideString::WStringLength(name));
if (!pDoc || wsName.IsEmpty())
return nullptr;
@@ -110,7 +109,7 @@ FPDFDoc_GetAttachment(FPDF_DOCUMENT document, int index) {
if (static_cast<size_t>(index) >= nameTree.GetCount())
return nullptr;
- CFX_WideString csName;
+ WideString csName;
return nameTree.LookupValueAndName(index, &csName);
}
@@ -171,8 +170,8 @@ FPDFAttachment_SetStringValue(FPDF_ATTACHMENT attachment,
if (!pParamsDict)
return false;
- CFX_ByteString bsKey = key;
- CFX_ByteString bsValue = CFXByteStringFromFPDFWideString(value);
+ ByteString bsKey = key;
+ ByteString bsValue = CFXByteStringFromFPDFWideString(value);
bool bEncodedAsHex = bsKey == kChecksumKey;
if (bEncodedAsHex)
bsValue = CFXByteStringHexDecode(bsValue);
@@ -194,12 +193,12 @@ FPDFAttachment_GetStringValue(FPDF_ATTACHMENT attachment,
if (!pParamsDict)
return 0;
- CFX_ByteString bsKey = key;
- CFX_WideString value = pParamsDict->GetUnicodeTextFor(bsKey);
+ ByteString bsKey = key;
+ WideString value = pParamsDict->GetUnicodeTextFor(bsKey);
if (bsKey == kChecksumKey && !value.IsEmpty()) {
CPDF_String* stringValue = pParamsDict->GetObjectFor(bsKey)->AsString();
if (stringValue->IsHex()) {
- CFX_ByteString encoded = PDF_EncodeString(stringValue->GetString(), true);
+ ByteString encoded = PDF_EncodeString(stringValue->GetString(), true);
value = CPDF_String(nullptr, encoded, false).GetUnicodeText();
}
}
@@ -233,7 +232,7 @@ FPDFAttachment_SetFile(FPDF_ATTACHMENT attachment,
// Set the creation date of the new attachment in the dictionary.
CFX_DateTime dateTime;
dateTime.Now();
- CFX_ByteString bsDateTime;
+ ByteString bsDateTime;
bsDateTime.Format("D:%d%02d%02d%02d%02d%02d", dateTime.GetYear(),
dateTime.GetMonth(), dateTime.GetDay(), dateTime.GetHour(),
dateTime.GetMinute(), dateTime.GetSecond());
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index f73336a94f..c3910b2883 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -24,7 +24,7 @@ namespace {
CPDF_Bookmark FindBookmark(const CPDF_BookmarkTree& tree,
CPDF_Bookmark bookmark,
- const CFX_WideString& title,
+ const WideString& title,
std::set<CPDF_Dictionary*>* visited) {
// Return if already checked to avoid circular calling.
if (pdfium::ContainsKey(*visited, bookmark.GetDict()))
@@ -91,7 +91,7 @@ FPDFBookmark_GetTitle(FPDF_BOOKMARK pDict, void* buffer, unsigned long buflen) {
if (!pDict)
return 0;
CPDF_Bookmark bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict)));
- CFX_WideString title = bookmark.GetTitle();
+ WideString title = bookmark.GetTitle();
return Utf16EncodeMaybeCopyAndReturnLength(title, buffer, buflen);
}
@@ -103,8 +103,8 @@ FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title) {
if (!pDoc)
return nullptr;
CPDF_BookmarkTree tree(pDoc);
- FX_STRSIZE len = CFX_WideString::WStringLength(title);
- CFX_WideString encodedTitle = CFX_WideString::FromUTF16LE(title, len);
+ FX_STRSIZE len = WideString::WStringLength(title);
+ WideString encodedTitle = WideString::FromUTF16LE(title, len);
std::set<CPDF_Dictionary*> visited;
return FindBookmark(tree, CPDF_Bookmark(), encodedTitle, &visited).GetDict();
}
@@ -174,7 +174,7 @@ FPDFAction_GetFilePath(FPDF_ACTION pDict, void* buffer, unsigned long buflen) {
return 0;
CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict)));
- CFX_ByteString path = action.GetFilePath().UTF8Encode();
+ ByteString path = action.GetFilePath().UTF8Encode();
unsigned long len = path.GetLength() + 1;
if (buffer && len <= buflen)
memcpy(buffer, path.c_str(), len);
@@ -192,7 +192,7 @@ FPDFAction_GetURIPath(FPDF_DOCUMENT document,
if (!pDoc)
return 0;
CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict)));
- CFX_ByteString path = action.GetURI(pDoc);
+ ByteString path = action.GetURI(pDoc);
unsigned long len = path.GetLength() + 1;
if (buffer && len <= buflen)
memcpy(buffer, path.c_str(), len);
@@ -390,7 +390,7 @@ FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document,
const CPDF_Dictionary* pInfo = pDoc->GetInfo();
if (!pInfo)
return 0;
- CFX_WideString text = pInfo->GetUnicodeTextFor(tag);
+ WideString text = pInfo->GetUnicodeTextFor(tag);
return Utf16EncodeMaybeCopyAndReturnLength(text, buffer, buflen);
}
@@ -404,7 +404,7 @@ FPDF_GetPageLabel(FPDF_DOCUMENT document,
// CPDF_PageLabel can deal with NULL |document|.
CPDF_PageLabel label(CPDFDocumentFromFPDFDocument(document));
- CFX_WideString str;
+ WideString str;
if (!label.GetLabel(page_index, &str))
return 0;
return Utf16EncodeMaybeCopyAndReturnLength(str, buffer, buflen);
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp
index b44a8ecc80..5db610e030 100644
--- a/fpdfsdk/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/fpdfdoc_embeddertest.cpp
@@ -125,16 +125,14 @@ TEST_F(FPDFDocEmbeddertest, Bookmarks) {
FPDF_BOOKMARK child = FPDFBookmark_GetFirstChild(document(), nullptr);
EXPECT_TRUE(child);
EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(L"A Good Beginning"),
- CFX_WideString::FromUTF16LE(buf, 16));
+ EXPECT_EQ(WideString(L"A Good Beginning"), WideString::FromUTF16LE(buf, 16));
EXPECT_EQ(nullptr, FPDFBookmark_GetFirstChild(document(), child));
FPDF_BOOKMARK sibling = FPDFBookmark_GetNextSibling(document(), child);
EXPECT_TRUE(sibling);
EXPECT_EQ(28u, FPDFBookmark_GetTitle(sibling, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(L"A Good Ending"),
- CFX_WideString::FromUTF16LE(buf, 13));
+ EXPECT_EQ(WideString(L"A Good Ending"), WideString::FromUTF16LE(buf, 13));
EXPECT_EQ(nullptr, FPDFBookmark_GetNextSibling(document(), sibling));
}
@@ -152,8 +150,7 @@ TEST_F(FPDFDocEmbeddertest, FindBookmarks) {
// Check that the string matches.
unsigned short buf[128];
EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(L"A Good Beginning"),
- CFX_WideString::FromUTF16LE(buf, 16));
+ EXPECT_EQ(WideString(L"A Good Beginning"), WideString::FromUTF16LE(buf, 16));
// Check that it is them same as the one returned by GetFirstChild.
EXPECT_EQ(child, FPDFBookmark_GetFirstChild(document(), nullptr));
@@ -201,19 +198,19 @@ TEST_F(FPDFDocEmbeddertest, GetMetaText) {
constexpr wchar_t kExpectedCreator[] = L"Microsoft Word";
ASSERT_EQ(30u, FPDF_GetMetaText(document(), "Creator", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedCreator),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreator)));
+ EXPECT_EQ(WideString(kExpectedCreator),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreator)));
constexpr wchar_t kExpectedCreationDate[] = L"D:20160411190039+00'00'";
ASSERT_EQ(48u,
FPDF_GetMetaText(document(), "CreationDate", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedCreationDate),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreationDate)));
+ EXPECT_EQ(WideString(kExpectedCreationDate),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreationDate)));
constexpr wchar_t kExpectedModDate[] = L"D:20160411190039+00'00'";
ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedModDate),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
+ EXPECT_EQ(WideString(kExpectedModDate),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
}
TEST_F(FPDFDocEmbeddertest, GetMetaTextSameObjectNumber) {
@@ -225,8 +222,8 @@ TEST_F(FPDFDocEmbeddertest, GetMetaTextSameObjectNumber) {
unsigned short buf[128];
constexpr wchar_t kExpectedModDate[] = L"D:20170612232940-04'00'";
ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedModDate),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
+ EXPECT_EQ(WideString(kExpectedModDate),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
}
TEST_F(FPDFDocEmbeddertest, GetMetaTextInAttachmentFile) {
@@ -236,8 +233,8 @@ TEST_F(FPDFDocEmbeddertest, GetMetaTextInAttachmentFile) {
unsigned short buf[128];
constexpr wchar_t kExpectedModDate[] = L"D:20170712214448-07'00'";
ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedModDate),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
+ EXPECT_EQ(WideString(kExpectedModDate),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate)));
}
TEST_F(FPDFDocEmbeddertest, NoPageLabels) {
@@ -257,38 +254,38 @@ TEST_F(FPDFDocEmbeddertest, GetPageLabels) {
const wchar_t kExpectedPageLabel0[] = L"i";
ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 0, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel0),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel0)));
+ EXPECT_EQ(WideString(kExpectedPageLabel0),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel0)));
const wchar_t kExpectedPageLabel1[] = L"ii";
ASSERT_EQ(6u, FPDF_GetPageLabel(document(), 1, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel1),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel1)));
+ EXPECT_EQ(WideString(kExpectedPageLabel1),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel1)));
const wchar_t kExpectedPageLabel2[] = L"1";
ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 2, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel2),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel2)));
+ EXPECT_EQ(WideString(kExpectedPageLabel2),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel2)));
const wchar_t kExpectedPageLabel3[] = L"2";
ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 3, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel3),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel3)));
+ EXPECT_EQ(WideString(kExpectedPageLabel3),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel3)));
const wchar_t kExpectedPageLabel4[] = L"zzA";
ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 4, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel4),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel4)));
+ EXPECT_EQ(WideString(kExpectedPageLabel4),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel4)));
const wchar_t kExpectedPageLabel5[] = L"zzB";
ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 5, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel5),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel5)));
+ EXPECT_EQ(WideString(kExpectedPageLabel5),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel5)));
const wchar_t kExpectedPageLabel6[] = L"";
ASSERT_EQ(2u, FPDF_GetPageLabel(document(), 6, buf, sizeof(buf)));
- EXPECT_EQ(CFX_WideString(kExpectedPageLabel6),
- CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel6)));
+ EXPECT_EQ(WideString(kExpectedPageLabel6),
+ WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel6)));
ASSERT_EQ(0u, FPDF_GetPageLabel(document(), 7, buf, sizeof(buf)));
ASSERT_EQ(0u, FPDF_GetPageLabel(document(), 8, buf, sizeof(buf)));
diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp
index faf6d97adf..ca2a457147 100644
--- a/fpdfsdk/fpdfedit_embeddertest.cpp
+++ b/fpdfsdk/fpdfedit_embeddertest.cpp
@@ -64,8 +64,8 @@ class FPDFEditEmbeddertest : public EmbedderTest {
EXPECT_TRUE(font_desc->KeyExist("Descent"));
EXPECT_TRUE(font_desc->KeyExist("CapHeight"));
EXPECT_TRUE(font_desc->KeyExist("StemV"));
- CFX_ByteString present("FontFile");
- CFX_ByteString absent("FontFile2");
+ ByteString present("FontFile");
+ ByteString absent("FontFile2");
if (font_type == FPDF_FONT_TRUETYPE)
std::swap(present, absent);
EXPECT_TRUE(font_desc->KeyExist(present));
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index 5e3191635e..7036aa2ffd 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -244,7 +244,7 @@ FPDFImageObj_GetImageFilter(FPDF_PAGEOBJECT image_object,
CPDF_PageObject* pObj = CPDFPageObjectFromFPDFPageObject(image_object);
CPDF_Object* pFilter =
pObj->AsImage()->GetImage()->GetDict()->GetDirectObjectFor("Filter");
- CFX_ByteString bsFilter;
+ ByteString bsFilter;
if (pFilter->IsName())
bsFilter = pFilter->AsName()->GetString();
else
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index 79155e52d5..26f4424d10 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -100,7 +100,7 @@ FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument() {
pDoc->CreateNewDoc();
time_t currentTime;
- CFX_ByteString DateStr;
+ ByteString DateStr;
if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) {
if (time(&currentTime) != -1) {
tm* pTM = localtime(&currentTime);
diff --git a/fpdfsdk/fpdfedittext.cpp b/fpdfsdk/fpdfedittext.cpp
index 38f7cc2562..2ac32b82a3 100644
--- a/fpdfsdk/fpdfedittext.cpp
+++ b/fpdfsdk/fpdfedittext.cpp
@@ -28,7 +28,7 @@
namespace {
CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc,
- const CFX_ByteString& font_name,
+ const ByteString& font_name,
CFX_Font* pFont,
const uint8_t* data,
uint32_t size,
@@ -71,8 +71,7 @@ CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc,
CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>();
pStream->SetData(data, size);
- CFX_ByteString fontFile =
- font_type == FPDF_FONT_TYPE1 ? "FontFile" : "FontFile2";
+ ByteString fontFile = font_type == FPDF_FONT_TYPE1 ? "FontFile" : "FontFile2";
fontDesc->SetNewFor<CPDF_Reference>(fontFile, pDoc, pStream->GetObjNum());
return fontDesc;
}
@@ -243,7 +242,7 @@ void* LoadSimpleFont(CPDF_Document* pDoc,
fontDict->SetNewFor<CPDF_Name>("Type", "Font");
fontDict->SetNewFor<CPDF_Name>(
"Subtype", font_type == FPDF_FONT_TYPE1 ? "Type1" : "TrueType");
- CFX_ByteString name = pFont->GetFaceName();
+ ByteString name = pFont->GetFaceName();
if (name.IsEmpty())
name = "Unnamed";
fontDict->SetNewFor<CPDF_Name>("BaseFont", name);
@@ -286,9 +285,9 @@ void* LoadCompositeFont(CPDF_Document* pDoc,
fontDict->SetNewFor<CPDF_Name>("Type", "Font");
fontDict->SetNewFor<CPDF_Name>("Subtype", "Type0");
// TODO(npm): Get the correct encoding, if it's not identity.
- CFX_ByteString encoding = "Identity-H";
+ ByteString encoding = "Identity-H";
fontDict->SetNewFor<CPDF_Name>("Encoding", encoding);
- CFX_ByteString name = pFont->GetFaceName();
+ ByteString name = pFont->GetFaceName();
if (name.IsEmpty())
name = "Unnamed";
fontDict->SetNewFor<CPDF_Name>(
@@ -404,7 +403,7 @@ FPDFPageObj_NewTextObj(FPDF_DOCUMENT document,
if (!pDoc)
return nullptr;
- CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc, CFX_ByteStringC(font));
+ CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc, ByteStringView(font));
if (!pFont)
return nullptr;
@@ -421,9 +420,9 @@ FPDFText_SetText(FPDF_PAGEOBJECT text_object, FPDF_WIDESTRING text) {
if (!pTextObj)
return false;
- FX_STRSIZE len = CFX_WideString::WStringLength(text);
- CFX_WideString encodedText = CFX_WideString::FromUTF16LE(text, len);
- CFX_ByteString byteText;
+ FX_STRSIZE len = WideString::WStringLength(text);
+ WideString encodedText = WideString::FromUTF16LE(text, len);
+ ByteString byteText;
for (wchar_t wc : encodedText) {
pTextObj->GetFont()->AppendChar(
&byteText, pTextObj->GetFont()->CharCodeFromUnicode(wc));
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 1b5cc483a8..77cba50c7c 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -66,11 +66,11 @@ CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle,
}
#ifdef PDF_ENABLE_XFA
-std::vector<CFX_ByteString>* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) {
- return static_cast<std::vector<CFX_ByteString>*>(handle);
+std::vector<ByteString>* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) {
+ return static_cast<std::vector<ByteString>*>(handle);
}
-FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector<CFX_ByteString>* strings) {
+FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector<ByteString>* strings) {
return static_cast<FPDF_STRINGHANDLE>(strings);
}
#endif // PDF_ENABLE_XFA
@@ -387,8 +387,8 @@ FORM_GetSelectedText(FPDF_FORMHANDLE hHandle,
if (!pPageView)
return 0;
- CFX_WideString wide_str_form_text = pPageView->GetSelectedText();
- CFX_ByteString encoded_form_text = wide_str_form_text.UTF16LE_Encode();
+ WideString wide_str_form_text = pPageView->GetSelectedText();
+ ByteString encoded_form_text = wide_str_form_text.UTF16LE_Encode();
unsigned long form_text_len = encoded_form_text.GetLength();
if (buffer && buflen >= form_text_len)
@@ -404,8 +404,8 @@ FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceSelection(FPDF_FORMHANDLE hHandle,
if (!pPageView)
return;
- FX_STRSIZE len = CFX_WideString::WStringLength(wsText);
- CFX_WideString wide_str_text = CFX_WideString::FromUTF16LE(wsText, len);
+ FX_STRSIZE len = WideString::WStringLength(wsText);
+ WideString wide_str_text = WideString::FromUTF16LE(wsText, len);
pPageView->ReplaceSelection(wide_str_text);
}
@@ -500,10 +500,10 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Copy(FPDF_DOCUMENT document,
pContext->GetDocType() != XFA_DocType::Static)
return;
- CFX_WideString wsCpText;
+ WideString wsCpText;
static_cast<CXFA_FFWidget*>(hWidget)->Copy(wsCpText);
- CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
+ ByteString bsCpText = wsCpText.UTF16LE_Encode();
uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
if (!wsText) {
*size = len;
@@ -532,10 +532,10 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Cut(FPDF_DOCUMENT document,
pContext->GetDocType() != XFA_DocType::Static)
return;
- CFX_WideString wsCpText;
+ WideString wsCpText;
static_cast<CXFA_FFWidget*>(hWidget)->Cut(wsCpText);
- CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
+ ByteString bsCpText = wsCpText.UTF16LE_Encode();
uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
if (!wsText) {
*size = len;
@@ -564,7 +564,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Paste(FPDF_DOCUMENT document,
pContext->GetDocType() != XFA_DocType::Static)
return;
- CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size);
+ WideString wstr = WideString::FromUTF16LE(wsText, size);
static_cast<CXFA_FFWidget*>(hWidget)->Paste(wstr);
}
@@ -585,7 +585,7 @@ FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document,
CFX_PointF ptPopup;
ptPopup.x = x;
ptPopup.y = y;
- CFX_ByteStringC bs(bsText);
+ ByteStringView bs(bsText);
static_cast<CXFA_FFWidget*>(hWidget)->ReplaceSpellCheckWord(ptPopup, bs);
}
@@ -606,7 +606,7 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document,
CFX_PointF ptPopup;
ptPopup.x = x;
ptPopup.y = y;
- auto sSuggestWords = pdfium::MakeUnique<std::vector<CFX_ByteString>>();
+ auto sSuggestWords = pdfium::MakeUnique<std::vector<ByteString>>();
static_cast<CXFA_FFWidget*>(hWidget)->GetSuggestWords(ptPopup,
sSuggestWords.get());
@@ -616,7 +616,7 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document,
FPDF_EXPORT int FPDF_CALLCONV
FPDF_StringHandleCounts(FPDF_STRINGHANDLE sHandle) {
- std::vector<CFX_ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle);
+ std::vector<ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle);
return sSuggestWords ? pdfium::CollectionSize<int>(*sSuggestWords) : -1;
}
@@ -632,7 +632,7 @@ FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE sHandle,
if (index < 0 || index >= count)
return false;
- std::vector<CFX_ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle);
+ std::vector<ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle);
uint32_t len = (*sSuggestWords)[index].GetLength();
if (!bsText) {
*size = len;
@@ -658,7 +658,7 @@ FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle,
if (!stringHandle || !bsText || size == 0)
return false;
- FromFPDFStringHandle(stringHandle)->push_back(CFX_ByteString(bsText, size));
+ FromFPDFStringHandle(stringHandle)->push_back(ByteString(bsText, size));
return true;
}
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfformfill_embeddertest.cpp b/fpdfsdk/fpdfformfill_embeddertest.cpp
index 56e166252e..2597b37160 100644
--- a/fpdfsdk/fpdfformfill_embeddertest.cpp
+++ b/fpdfsdk/fpdfformfill_embeddertest.cpp
@@ -106,7 +106,7 @@ class FPDFFormFillInteractiveEmbeddertest : public FPDFFormFillEmbeddertest {
FORM_OnLButtonUp(form_handle(), page_, 0, end.x, end.y);
}
- void CheckSelection(const CFX_WideStringC& expected_string) {
+ void CheckSelection(const WideStringView& expected_string) {
// Calculate expected length for selected text.
int num_chars = expected_string.GetLength();
@@ -121,8 +121,7 @@ class FPDFFormFillInteractiveEmbeddertest : public FPDFFormFillEmbeddertest {
EXPECT_EQ(expected_length, FORM_GetSelectedText(form_handle(), page_,
buf.data(), sel_text_len));
- EXPECT_EQ(expected_string,
- CFX_WideString::FromUTF16LE(buf.data(), num_chars));
+ EXPECT_EQ(expected_string, WideString::FromUTF16LE(buf.data(), num_chars));
}
private:
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index d08de020bb..230fd14fc8 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -26,7 +26,7 @@
namespace {
CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict,
- const CFX_ByteString& bsSrcTag) {
+ const ByteString& bsSrcTag) {
if (!pDict || bsSrcTag.IsEmpty())
return nullptr;
if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type"))
@@ -58,7 +58,7 @@ CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict,
bool CopyInheritable(CPDF_Dictionary* pCurPageDict,
CPDF_Dictionary* pSrcPageDict,
- const CFX_ByteString& key) {
+ const ByteString& key) {
if (pCurPageDict->KeyExist(key))
return true;
@@ -70,7 +70,7 @@ bool CopyInheritable(CPDF_Dictionary* pCurPageDict,
return true;
}
-bool ParserPageRangeString(CFX_ByteString rangstring,
+bool ParserPageRangeString(ByteString rangstring,
std::vector<uint16_t>* pageArray,
int nCount) {
if (rangstring.IsEmpty())
@@ -78,13 +78,13 @@ bool ParserPageRangeString(CFX_ByteString rangstring,
rangstring.Remove(' ');
FX_STRSIZE nLength = rangstring.GetLength();
- CFX_ByteString cbCompareString("0123456789-,");
+ ByteString cbCompareString("0123456789-,");
for (FX_STRSIZE i = 0; i < nLength; ++i) {
if (!cbCompareString.Contains(rangstring[i]))
return false;
}
- CFX_ByteString cbMidRange;
+ ByteString cbMidRange;
FX_STRSIZE nStringFrom = 0;
pdfium::Optional<FX_STRSIZE> nStringTo = 0;
while (nStringTo < nLength) {
@@ -165,7 +165,7 @@ bool CPDF_PageOrganizer::PDFDocInit() {
pDocInfoDict->SetNewFor<CPDF_String>("Producer", "PDFium", false);
- CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", "");
+ ByteString cbRootType = pNewRoot->GetStringFor("Type", "");
if (cbRootType.IsEmpty())
pNewRoot->SetNewFor<CPDF_Name>("Type", "Catalog");
@@ -178,7 +178,7 @@ bool CPDF_PageOrganizer::PDFDocInit() {
pNewPages->GetObjNum());
}
- CFX_ByteString cbPageType = pNewPages->GetStringFor("Type", "");
+ ByteString cbPageType = pNewPages->GetStringFor("Type", "");
if (cbPageType.IsEmpty())
pNewPages->SetNewFor<CPDF_Name>("Type", "Pages");
@@ -205,7 +205,7 @@ bool CPDF_PageOrganizer::ExportPage(const std::vector<uint16_t>& pageNums,
// Clone the page dictionary
for (const auto& it : *pSrcPageDict) {
- const CFX_ByteString& cbSrcKeyStr = it.first;
+ const ByteString& cbSrcKeyStr = it.first;
if (cbSrcKeyStr == "Type" || cbSrcKeyStr == "Parent")
continue;
@@ -271,7 +271,7 @@ bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
CPDF_Dictionary* pDict = pObj->AsDictionary();
auto it = pDict->begin();
while (it != pDict->end()) {
- const CFX_ByteString& key = it->first;
+ const ByteString& key = it->first;
CPDF_Object* pNextObj = it->second.get();
++it;
if (key == "Parent" || key == "Prev" || key == "First")
@@ -330,7 +330,7 @@ uint32_t CPDF_PageOrganizer::GetNewObjId(ObjectNumberMap* pObjNumberMap,
std::unique_ptr<CPDF_Object> pClone = pDirect->Clone();
if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) {
if (pDictClone->KeyExist("Type")) {
- CFX_ByteString strType = pDictClone->GetStringFor("Type");
+ ByteString strType = pDictClone->GetStringFor("Type");
if (!FXSYS_stricmp(strType.c_str(), "Pages"))
return 4;
if (!FXSYS_stricmp(strType.c_str(), "Page"))
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index 5b68da4eee..9742974c3a 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -171,7 +171,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE text_page,
if (start >= textpage->CountChars())
return 0;
- CFX_WideString str = textpage->GetPageText(start, count - 1);
+ WideString str = textpage->GetPageText(start, count - 1);
if (str.GetLength() <= 0)
return 0;
@@ -180,7 +180,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE text_page,
// UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
// the number of items to stay the same.
- CFX_ByteString cbUTF16str = str.UTF16LE_Encode();
+ ByteString cbUTF16str = str.UTF16LE_Encode();
ASSERT(cbUTF16str.GetLength() / kBytesPerCharacter <=
static_cast<size_t>(count));
memcpy(result, cbUTF16str.GetBuffer(cbUTF16str.GetLength()),
@@ -229,12 +229,12 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page);
CFX_FloatRect rect((float)left, (float)bottom, (float)right, (float)top);
- CFX_WideString str = textpage->GetTextByRect(rect);
+ WideString str = textpage->GetTextByRect(rect);
if (buflen <= 0 || !buffer)
return str.GetLength();
- CFX_ByteString cbUTF16Str = str.UTF16LE_Encode();
+ ByteString cbUTF16Str = str.UTF16LE_Encode();
int len = cbUTF16Str.GetLength() / sizeof(unsigned short);
int size = buflen > len ? len : buflen;
memcpy(buffer, cbUTF16Str.GetBuffer(size * sizeof(unsigned short)),
@@ -256,8 +256,8 @@ FPDFText_FindStart(FPDF_TEXTPAGE text_page,
CPDF_TextPageFind* textpageFind =
new CPDF_TextPageFind(CPDFTextPageFromFPDFTextPage(text_page));
- FX_STRSIZE len = CFX_WideString::WStringLength(findwhat);
- textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags,
+ FX_STRSIZE len = WideString::WStringLength(findwhat);
+ textpageFind->FindFirst(WideString::FromUTF16LE(findwhat, len), flags,
start_index >= 0
? pdfium::Optional<FX_STRSIZE>(start_index)
: pdfium::Optional<FX_STRSIZE>());
@@ -330,12 +330,12 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetURL(FPDF_PAGELINK link_page,
int link_index,
unsigned short* buffer,
int buflen) {
- CFX_WideString wsUrl(L"");
+ WideString wsUrl(L"");
if (link_page && link_index >= 0) {
CPDF_LinkExtract* pageLink = CPDFLinkExtractFromFPDFPageLink(link_page);
wsUrl = pageLink->GetURL(link_index);
}
- CFX_ByteString cbUTF16URL = wsUrl.UTF16LE_Encode();
+ ByteString cbUTF16URL = wsUrl.UTF16LE_Encode();
int required = cbUTF16URL.GetLength() / sizeof(unsigned short);
if (!buffer || buflen <= 0)
return required;
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 0aaafe8afb..8bca376cdf 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -348,9 +348,9 @@ CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment) {
return static_cast<CPDF_Object*>(attachment);
}
-CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string) {
- return CFX_WideString::FromUTF16LE(wide_string,
- CFX_WideString::WStringLength(wide_string))
+ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string) {
+ return WideString::FromUTF16LE(wide_string,
+ WideString::WStringLength(wide_string))
.UTF8Encode();
}
@@ -358,10 +358,10 @@ CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap) {
return static_cast<CFX_DIBitmap*>(bitmap);
}
-unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text,
+unsigned long Utf16EncodeMaybeCopyAndReturnLength(const WideString& text,
void* buffer,
unsigned long buflen) {
- CFX_ByteString encoded_text = text.UTF16LE_Encode();
+ ByteString encoded_text = text.UTF16LE_Encode();
unsigned long len = encoded_text.GetLength();
if (buffer && len <= buflen)
memcpy(buffer, encoded_text.c_str(), len);
@@ -380,7 +380,7 @@ unsigned long DecodeStreamMaybeCopyAndReturnLength(const CPDF_Stream* stream,
// Decode the stream if one or more stream filters are specified.
uint8_t* decoded_data = nullptr;
uint32_t decoded_len = 0;
- CFX_ByteString dummy_last_decoder;
+ ByteString dummy_last_decoder;
CPDF_Dictionary* dummy_last_param;
if (PDF_DataDecode(data, len, dict, dict->GetIntegerFor("DL"), false,
&decoded_data, &decoded_len, &dummy_last_decoder,
@@ -1313,7 +1313,7 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document) {
if (!pDoc)
return DuplexUndefined;
CPDF_ViewerPreferences viewRef(pDoc);
- CFX_ByteString duplex = viewRef.Duplex();
+ ByteString duplex = viewRef.Duplex();
if ("Simplex" == duplex)
return Simplex;
if ("DuplexFlipShortEdge" == duplex)
@@ -1333,7 +1333,7 @@ FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document,
return 0;
CPDF_ViewerPreferences viewRef(pDoc);
- CFX_ByteString bsVal;
+ ByteString bsVal;
if (!viewRef.GenericName(key, &bsVal))
return 0;
@@ -1375,7 +1375,7 @@ FPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_BYTESTRING name) {
return nullptr;
CPDF_NameTree name_tree(pDoc, "Dests");
- return name_tree.LookupNamedDest(pDoc, PDF_DecodeText(CFX_ByteString(name)));
+ return name_tree.LookupNamedDest(pDoc, PDF_DecodeText(ByteString(name)));
}
#ifdef PDF_ENABLE_XFA
@@ -1450,7 +1450,7 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document,
return nullptr;
CPDF_Object* pDestObj = nullptr;
- CFX_WideString wsName;
+ WideString wsName;
CPDF_NameTree nameTree(pDoc, "Dests");
int count = nameTree.GetCount();
if (index >= count) {
@@ -1465,7 +1465,7 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document,
index -= count;
int i = 0;
- CFX_ByteString bsName;
+ ByteString bsName;
for (const auto& it : *pDest) {
bsName = it.first;
pDestObj = it.second.get();
@@ -1489,7 +1489,7 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document,
if (!pDestObj->IsArray())
return nullptr;
- CFX_ByteString utf16Name = wsName.UTF16LE_Encode();
+ ByteString utf16Name = wsName.UTF16LE_Encode();
int len = utf16Name.GetLength();
if (!buffer) {
*buflen = len;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 1032d49edc..8779c44186 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -219,19 +219,19 @@ v8::Isolate* CPDFXFA_Context::GetJSERuntime() const {
return runtime->GetIsolate();
}
-CFX_WideString CPDFXFA_Context::GetAppTitle() const {
+WideString CPDFXFA_Context::GetAppTitle() const {
return L"PDFium";
}
-CFX_WideString CPDFXFA_Context::GetAppName() {
+WideString CPDFXFA_Context::GetAppName() {
return m_pFormFillEnv ? m_pFormFillEnv->FFI_GetAppName() : L"";
}
-CFX_WideString CPDFXFA_Context::GetLanguage() {
+WideString CPDFXFA_Context::GetLanguage() {
return m_pFormFillEnv ? m_pFormFillEnv->GetLanguage() : L"";
}
-CFX_WideString CPDFXFA_Context::GetPlatform() {
+WideString CPDFXFA_Context::GetPlatform() {
return m_pFormFillEnv ? m_pFormFillEnv->GetPlatform() : L"";
}
@@ -240,8 +240,8 @@ void CPDFXFA_Context::Beep(uint32_t dwType) {
m_pFormFillEnv->JS_appBeep(dwType);
}
-int32_t CPDFXFA_Context::MsgBox(const CFX_WideString& wsMessage,
- const CFX_WideString& wsTitle,
+int32_t CPDFXFA_Context::MsgBox(const WideString& wsMessage,
+ const WideString& wsTitle,
uint32_t dwIconType,
uint32_t dwButtonType) {
if (!m_pFormFillEnv)
@@ -292,12 +292,12 @@ int32_t CPDFXFA_Context::MsgBox(const CFX_WideString& wsMessage,
return XFA_IDYes;
}
-CFX_WideString CPDFXFA_Context::Response(const CFX_WideString& wsQuestion,
- const CFX_WideString& wsTitle,
- const CFX_WideString& wsDefaultAnswer,
- bool bMark) {
+WideString CPDFXFA_Context::Response(const WideString& wsQuestion,
+ const WideString& wsTitle,
+ const WideString& wsDefaultAnswer,
+ bool bMark) {
if (!m_pFormFillEnv)
- return CFX_WideString();
+ return WideString();
int nLength = 2048;
std::vector<uint8_t> pBuff(nLength);
@@ -305,27 +305,27 @@ CFX_WideString CPDFXFA_Context::Response(const CFX_WideString& wsQuestion,
wsDefaultAnswer.c_str(), nullptr,
bMark, pBuff.data(), nLength);
if (nLength <= 0)
- return CFX_WideString();
+ return WideString();
nLength = std::min(2046, nLength);
pBuff[nLength] = 0;
pBuff[nLength + 1] = 0;
- return CFX_WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
- nLength / sizeof(uint16_t));
+ return WideString::FromUTF16LE(reinterpret_cast<uint16_t*>(pBuff.data()),
+ nLength / sizeof(uint16_t));
}
CFX_RetainPtr<IFX_SeekableReadStream> CPDFXFA_Context::DownloadURL(
- const CFX_WideString& wsURL) {
+ const WideString& wsURL) {
return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL.c_str())
: nullptr;
}
-bool CPDFXFA_Context::PostRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsContentType,
- const CFX_WideString& wsEncode,
- const CFX_WideString& wsHeader,
- CFX_WideString& wsResponse) {
+bool CPDFXFA_Context::PostRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsContentType,
+ const WideString& wsEncode,
+ const WideString& wsHeader,
+ WideString& wsResponse) {
if (!m_pFormFillEnv)
return false;
@@ -335,9 +335,9 @@ bool CPDFXFA_Context::PostRequestURL(const CFX_WideString& wsURL,
return true;
}
-bool CPDFXFA_Context::PutRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsEncode) {
+bool CPDFXFA_Context::PutRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsEncode) {
return m_pFormFillEnv &&
m_pFormFillEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(),
wsEncode.c_str());
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index 586e12d5be..a0f90ab37b 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -56,31 +56,31 @@ class CPDFXFA_Context : public IXFA_AppProvider {
void ClearChangeMark();
// IFXA_AppProvider:
- CFX_WideString GetLanguage() override;
- CFX_WideString GetPlatform() override;
- CFX_WideString GetAppName() override;
- CFX_WideString GetAppTitle() const override;
+ WideString GetLanguage() override;
+ WideString GetPlatform() override;
+ WideString GetAppName() override;
+ WideString GetAppTitle() const override;
void Beep(uint32_t dwType) override;
- int32_t MsgBox(const CFX_WideString& wsMessage,
- const CFX_WideString& wsTitle,
+ int32_t MsgBox(const WideString& wsMessage,
+ const WideString& wsTitle,
uint32_t dwIconType,
uint32_t dwButtonType) override;
- CFX_WideString Response(const CFX_WideString& wsQuestion,
- const CFX_WideString& wsTitle,
- const CFX_WideString& wsDefaultAnswer,
- bool bMark) override;
+ WideString Response(const WideString& wsQuestion,
+ const WideString& wsTitle,
+ const WideString& wsDefaultAnswer,
+ bool bMark) override;
CFX_RetainPtr<IFX_SeekableReadStream> DownloadURL(
- const CFX_WideString& wsURL) override;
- 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) override;
- bool PutRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsEncode) override;
+ const WideString& wsURL) override;
+ bool PostRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsContentType,
+ const WideString& wsEncode,
+ const WideString& wsHeader,
+ WideString& wsResponse) override;
+ bool PutRequestURL(const WideString& wsURL,
+ const WideString& wsData,
+ const WideString& wsEncode) override;
IFWL_AdapterTimerMgr* GetTimerMgr() override;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 65379254f0..b4dc3f1ed0 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -379,8 +379,7 @@ void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc,
}
}
-void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
- CFX_WideString& wsTitle) {
+void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, WideString& wsTitle) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
return;
@@ -388,13 +387,13 @@ void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
if (!pInfoDict)
return;
- CFX_ByteString csTitle = pInfoDict->GetStringFor("Title");
+ ByteString csTitle = pInfoDict->GetStringFor("Title");
wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength()));
csTitle.ReleaseBuffer(csTitle.GetLength());
}
void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsTitle) {
+ const WideString& wsTitle) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
return;
@@ -404,7 +403,7 @@ void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
}
void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsFilePath,
+ const WideString& wsFilePath,
bool bXDP) {
if (hDoc != m_pContext->GetXFADoc())
return;
@@ -419,14 +418,14 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
return;
int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML;
- CFX_ByteString bs = wsFilePath.UTF16LE_Encode();
+ ByteString bs = wsFilePath.UTF16LE_Encode();
if (wsFilePath.IsEmpty()) {
if (!pFormFillEnv->GetFormFillInfo() ||
!pFormFillEnv->GetFormFillInfo()->m_pJsPlatform) {
return;
}
- CFX_WideString filepath = pFormFillEnv->JS_fieldBrowse();
+ WideString filepath = pFormFillEnv->JS_fieldBrowse();
bs = filepath.UTF16LE_Encode();
}
int len = bs.GetLength();
@@ -439,7 +438,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
CFX_RetainPtr<IFX_SeekableStream> fileWrite =
MakeSeekableStream(pFileHandler);
- CFX_ByteString content;
+ ByteString content;
if (fileType == FXFA_SAVEAS_XML) {
content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
fileWrite->WriteBlock(content.c_str(), fileWrite->GetSize(),
@@ -485,10 +484,10 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
continue;
}
if (i == size - 1) {
- CFX_WideString wPath = CFX_WideString::FromUTF16LE(
+ WideString wPath = WideString::FromUTF16LE(
reinterpret_cast<const unsigned short*>(bs.c_str()),
bs.GetLength() / sizeof(unsigned short));
- CFX_ByteString bPath = wPath.UTF8Encode();
+ ByteString bPath = wPath.UTF8Encode();
const char* szFormat =
"\n<pdf href=\"%s\" xmlns=\"http://ns.adobe.com/xdp/pdf/\"/>";
content.Format(szFormat, bPath.c_str());
@@ -505,7 +504,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
}
void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
- const CFX_WideString& bsURL) {
+ const WideString& bsURL) {
if (hDoc != m_pContext->GetXFADoc())
return;
@@ -516,7 +515,7 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
if (!pFormFillEnv)
return;
- CFX_WideStringC str(bsURL.c_str());
+ WideStringView str(bsURL.c_str());
pFormFillEnv->GotoURL(m_pContext.Get(), str);
}
@@ -644,9 +643,9 @@ bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
if (!pFormFillEnv)
return false;
- CFX_WideString ws;
+ WideString ws;
ws.FromLocal(IDS_XFA_Validate_Input);
- CFX_ByteString bs = ws.UTF16LE_Encode();
+ ByteString bs = ws.UTF16LE_Encode();
int len = bs.GetLength();
pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
(FPDF_WIDESTRING)L"", 0, 1);
@@ -700,12 +699,12 @@ bool CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) {
CFX_RetainPtr<IFX_SeekableReadStream> CPDFXFA_DocEnvironment::OpenLinkedFile(
CXFA_FFDoc* hDoc,
- const CFX_WideString& wsLink) {
+ const WideString& wsLink) {
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return nullptr;
- CFX_ByteString bs = wsLink.UTF16LE_Encode();
+ ByteString bs = wsLink.UTF16LE_Encode();
int len = bs.GetLength();
FPDF_FILEHANDLER* pFileHandler =
pFormFillEnv->OpenFile(0, (FPDF_WIDESTRING)bs.GetBuffer(len), "rb");
@@ -723,7 +722,7 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
if (!m_pContext->GetXFADocView())
return false;
- CFX_ByteString content;
+ ByteString content;
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
return false;
@@ -808,7 +807,7 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
return true;
}
-void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent,
+void CPDFXFA_DocEnvironment::ToXFAContentFlags(WideString csSrcContent,
FPDF_DWORD& flag) {
if (csSrcContent.Contains(L" config "))
flag |= FXFA_CONFIG;
@@ -830,19 +829,19 @@ void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent,
}
}
-bool CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL,
- CFX_WideString& csToAddress,
- CFX_WideString& csCCAddress,
- CFX_WideString& csBCCAddress,
- CFX_WideString& csSubject,
- CFX_WideString& csMsg) {
- CFX_WideString srcURL = csURL;
+bool CPDFXFA_DocEnvironment::MailToInfo(WideString& csURL,
+ WideString& csToAddress,
+ WideString& csCCAddress,
+ WideString& csBCCAddress,
+ WideString& csSubject,
+ WideString& csMsg) {
+ WideString srcURL = csURL;
srcURL.TrimLeft();
if (srcURL.Left(7).CompareNoCase(L"mailto:") != 0)
return false;
auto pos = srcURL.Find(L'?');
- CFX_WideString tmp;
+ WideString tmp;
if (!pos.has_value()) {
pos = srcURL.Find(L'@');
if (!pos.has_value())
@@ -903,13 +902,13 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
if (!pFormFillEnv)
return false;
- CFX_WideStringC csURLC;
+ WideStringView csURLC;
submit.GetSubmitTarget(csURLC);
- CFX_WideString csURL(csURLC);
+ WideString csURL(csURLC);
if (csURL.IsEmpty()) {
- CFX_WideString ws;
+ WideString ws;
ws.FromLocal("Submit cancelled.");
- CFX_ByteString bs = ws.UTF16LE_Encode();
+ ByteString bs = ws.UTF16LE_Encode();
int len = bs.GetLength();
pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
(FPDF_WIDESTRING)L"", 0, 4);
@@ -921,13 +920,13 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
int fileFlag = -1;
switch (submit.GetSubmitFormat()) {
case XFA_ATTRIBUTEENUM_Xdp: {
- CFX_WideStringC csContentC;
+ WideStringView csContentC;
submit.GetSubmitXDPContent(csContentC);
- CFX_WideString csContent;
+ WideString csContent;
csContent = csContentC;
csContent.TrimLeft();
csContent.TrimRight();
- CFX_WideString space;
+ WideString space;
space.FromLocal(" ");
csContent = space + csContent + space;
FPDF_DWORD flag = 0;
@@ -958,20 +957,20 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
if (!pFileHandler)
return false;
if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) {
- CFX_WideString csToAddress;
- CFX_WideString csCCAddress;
- CFX_WideString csBCCAddress;
- CFX_WideString csSubject;
- CFX_WideString csMsg;
+ WideString csToAddress;
+ WideString csCCAddress;
+ WideString csBCCAddress;
+ WideString csSubject;
+ WideString csMsg;
if (!MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject,
csMsg)) {
return false;
}
- CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode();
- CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode();
- CFX_ByteString bsBcc = CFX_WideString(csBCCAddress).UTF16LE_Encode();
- CFX_ByteString bsSubject = CFX_WideString(csSubject).UTF16LE_Encode();
- CFX_ByteString bsMsg = CFX_WideString(csMsg).UTF16LE_Encode();
+ ByteString bsTo = WideString(csToAddress).UTF16LE_Encode();
+ ByteString bsCC = WideString(csCCAddress).UTF16LE_Encode();
+ ByteString bsBcc = WideString(csBCCAddress).UTF16LE_Encode();
+ ByteString bsSubject = WideString(csSubject).UTF16LE_Encode();
+ ByteString bsMsg = WideString(csMsg).UTF16LE_Encode();
FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength());
FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength());
FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength());
@@ -986,8 +985,8 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
bsMsg.ReleaseBuffer(bsMsg.GetStringLength());
} else {
// HTTP or FTP
- CFX_WideString ws;
- CFX_ByteString bs = csURL.UTF16LE_Encode();
+ WideString ws;
+ ByteString bs = csURL.UTF16LE_Encode();
int len = bs.GetLength();
pFormFillEnv->UploadTo(pFileHandler, fileFlag,
(FPDF_WIDESTRING)bs.GetBuffer(len));
@@ -996,10 +995,9 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
return true;
}
-bool CPDFXFA_DocEnvironment::SetGlobalProperty(
- CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
- CFXJSE_Value* pValue) {
+bool CPDFXFA_DocEnvironment::SetGlobalProperty(CXFA_FFDoc* hDoc,
+ const ByteStringView& szPropName,
+ CFXJSE_Value* pValue) {
if (hDoc != m_pContext->GetXFADoc())
return false;
if (!m_pContext->GetFormFillEnv() ||
@@ -1013,10 +1011,9 @@ bool CPDFXFA_DocEnvironment::SetGlobalProperty(
return bRet;
}
-bool CPDFXFA_DocEnvironment::GetGlobalProperty(
- CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
- CFXJSE_Value* pValue) {
+bool CPDFXFA_DocEnvironment::GetGlobalProperty(CXFA_FFDoc* hDoc,
+ const ByteStringView& szPropName,
+ CFXJSE_Value* pValue) {
if (hDoc != m_pContext->GetXFADoc())
return false;
if (!m_pContext->GetFormFillEnv() ||
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
index 90bc6dea04..e6a0f926af 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
@@ -49,12 +49,12 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override;
bool IsCalculationsEnabled(CXFA_FFDoc* hDoc) override;
void SetCalculationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override;
- void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override;
- void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override;
+ void GetTitle(CXFA_FFDoc* hDoc, WideString& wsTitle) override;
+ void SetTitle(CXFA_FFDoc* hDoc, const WideString& wsTitle) override;
void ExportData(CXFA_FFDoc* hDoc,
- const CFX_WideString& wsFilePath,
+ const WideString& wsFilePath,
bool bXDP) override;
- void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) override;
+ void GotoURL(CXFA_FFDoc* hDoc, const WideString& bsURL) override;
bool IsValidationsEnabled(CXFA_FFDoc* hDoc) override;
void SetValidationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override;
void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override;
@@ -79,32 +79,32 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
bool SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override;
bool GetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) override;
bool SetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) override;
CFX_RetainPtr<IFX_SeekableReadStream> OpenLinkedFile(
CXFA_FFDoc* hDoc,
- const CFX_WideString& wsLink) override;
+ const WideString& wsLink) override;
private:
bool OnBeforeNotifySubmit();
void OnAfterNotifySubmit();
bool NotifySubmit(bool bPrevOrPost);
bool SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit);
- bool MailToInfo(CFX_WideString& csURL,
- CFX_WideString& csToAddress,
- CFX_WideString& csCCAddress,
- CFX_WideString& csBCCAddress,
- CFX_WideString& csSubject,
- CFX_WideString& csMsg);
+ bool MailToInfo(WideString& csURL,
+ WideString& csToAddress,
+ WideString& csCCAddress,
+ WideString& csBCCAddress,
+ WideString& csSubject,
+ WideString& csMsg);
bool ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler,
int fileType,
FPDF_DWORD encodeType,
FPDF_DWORD flag);
- void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag);
+ void ToXFAContentFlags(WideString csSrcContent, FPDF_DWORD& flag);
CFX_UnownedPtr<CPDFXFA_Context> const m_pContext;
};
diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp
index 776a1714cd..ea7d2c3a08 100644
--- a/fpdfsdk/fsdk_actionhandler.cpp
+++ b/fpdfsdk/fsdk_actionhandler.cpp
@@ -29,10 +29,10 @@ bool CPDFSDK_ActionHandler::DoAction_DocOpen(
bool CPDFSDK_ActionHandler::DoAction_JavaScript(
const CPDF_Action& JsAction,
- CFX_WideString csJSName,
+ WideString csJSName,
CPDFSDK_FormFillEnvironment* pFormFillEnv) {
if (JsAction.GetType() == CPDF_Action::JavaScript) {
- CFX_WideString swJS = JsAction.GetJavaScript();
+ WideString swJS = JsAction.GetJavaScript();
if (!swJS.IsEmpty()) {
RunDocumentOpenJavaScript(pFormFillEnv, csJSName, swJS);
return true;
@@ -51,7 +51,7 @@ bool CPDFSDK_ActionHandler::DoAction_FieldJavaScript(
ASSERT(pFormFillEnv);
if (pFormFillEnv->IsJSInitiated() &&
JsAction.GetType() == CPDF_Action::JavaScript) {
- CFX_WideString swJS = JsAction.GetJavaScript();
+ WideString swJS = JsAction.GetJavaScript();
if (!swJS.IsEmpty()) {
RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS);
return true;
@@ -125,7 +125,7 @@ bool CPDFSDK_ActionHandler::ExecuteDocumentOpenAction(
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
RunDocumentOpenJavaScript(pFormFillEnv, L"", swJS);
}
@@ -156,13 +156,13 @@ bool CPDFSDK_ActionHandler::ExecuteLinkAction(
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnLink_MouseUp(pFormFillEnv);
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(swJS, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -197,7 +197,7 @@ bool CPDFSDK_ActionHandler::ExecuteDocumentPageAction(
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
RunDocumentPageJavaScript(pFormFillEnv, type, swJS);
}
@@ -244,7 +244,7 @@ bool CPDFSDK_ActionHandler::ExecuteFieldAction(
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS);
if (!IsValidField(pFormFillEnv, pFormField->GetFieldDict()))
@@ -280,11 +280,11 @@ bool CPDFSDK_ActionHandler::ExecuteScreenAction(
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(swJS, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -319,13 +319,13 @@ bool CPDFSDK_ActionHandler::ExecuteBookMark(
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
- CFX_WideString swJS = action.GetJavaScript();
+ WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnBookmark_MouseUp(pBookmark);
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(swJS, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -444,7 +444,7 @@ void CPDFSDK_ActionHandler::DoAction_URI(
const CPDF_Action& action) {
ASSERT(action.GetDict());
- CFX_ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument());
+ ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument());
pFormFillEnv->DoURIAction(sURI.c_str());
}
@@ -453,7 +453,7 @@ void CPDFSDK_ActionHandler::DoAction_Named(
const CPDF_Action& action) {
ASSERT(action.GetDict());
- CFX_ByteString csName = action.GetNamedAction();
+ ByteString csName = action.GetNamedAction();
pFormFillEnv->ExecuteNamedAction(csName.c_str());
}
@@ -466,7 +466,7 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript(
CPDF_FormField* pFormField,
CPDF_AAction::AActionType type,
PDFSDK_FieldAction& data,
- const CFX_WideString& script) {
+ const WideString& script) {
ASSERT(type != CPDF_AAction::Calculate);
ASSERT(type != CPDF_AAction::Format);
@@ -509,7 +509,7 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript(
break;
}
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(script, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -519,13 +519,13 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript(
void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& sScriptName,
- const CFX_WideString& script) {
+ const WideString& sScriptName,
+ const WideString& script) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnDoc_Open(pFormFillEnv, sScriptName);
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(script, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
@@ -536,7 +536,7 @@ void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript(
void CPDFSDK_ActionHandler::RunDocumentPageJavaScript(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_AAction::AActionType type,
- const CFX_WideString& script) {
+ const WideString& script) {
IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime();
IJS_EventContext* pContext = pRuntime->NewEventContext();
switch (type) {
@@ -572,7 +572,7 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript(
break;
}
- CFX_WideString csInfo;
+ WideString csInfo;
bool bRet = pContext->RunScript(script, &csInfo);
pRuntime->ReleaseEventContext(pContext);
if (!bRet) {
diff --git a/fpdfsdk/fsdk_actionhandler.h b/fpdfsdk/fsdk_actionhandler.h
index 1c8dedefd7..7457b4ed91 100644
--- a/fpdfsdk/fsdk_actionhandler.h
+++ b/fpdfsdk/fsdk_actionhandler.h
@@ -26,7 +26,7 @@ class CPDFSDK_ActionHandler {
bool DoAction_DocOpen(const CPDF_Action& action,
CPDFSDK_FormFillEnvironment* pFormFillEnv);
bool DoAction_JavaScript(const CPDF_Action& JsAction,
- CFX_WideString csJSName,
+ WideString csJSName,
CPDFSDK_FormFillEnvironment* pFormFillEnv);
bool DoAction_Page(const CPDF_Action& action,
enum CPDF_AAction::AActionType eType,
@@ -86,15 +86,15 @@ class CPDFSDK_ActionHandler {
CPDFSDK_FormFillEnvironment* pFormFillEnv);
void RunDocumentPageJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_AAction::AActionType type,
- const CFX_WideString& script);
+ const WideString& script);
void RunDocumentOpenJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& sScriptName,
- const CFX_WideString& script);
+ const WideString& sScriptName,
+ const WideString& script);
void RunFieldJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormField* pFormField,
CPDF_AAction::AActionType type,
PDFSDK_FieldAction& data,
- const CFX_WideString& script);
+ const WideString& script);
bool IsValidField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_Dictionary* pFieldDict);
diff --git a/fpdfsdk/fsdk_define.h b/fpdfsdk/fsdk_define.h
index 91efc27f1a..e58ddb1a49 100644
--- a/fpdfsdk/fsdk_define.h
+++ b/fpdfsdk/fsdk_define.h
@@ -70,11 +70,11 @@ CPDF_PageObject* CPDFPageObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object);
CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment);
-CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
+ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap);
-unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text,
+unsigned long Utf16EncodeMaybeCopyAndReturnLength(const WideString& text,
void* buffer,
unsigned long buflen);
diff --git a/fpdfsdk/fsdk_filewriteadapter.cpp b/fpdfsdk/fsdk_filewriteadapter.cpp
index 50394c3286..fad058fb54 100644
--- a/fpdfsdk/fsdk_filewriteadapter.cpp
+++ b/fpdfsdk/fsdk_filewriteadapter.cpp
@@ -17,6 +17,6 @@ bool FSDK_FileWriteAdapter::WriteBlock(const void* data, size_t size) {
return fileWriteStruct_->WriteBlock(fileWriteStruct_, data, size) != 0;
}
-bool FSDK_FileWriteAdapter::WriteString(const CFX_ByteStringC& str) {
+bool FSDK_FileWriteAdapter::WriteString(const ByteStringView& str) {
return WriteBlock(str.unterminated_c_str(), str.GetLength());
}
diff --git a/fpdfsdk/fsdk_filewriteadapter.h b/fpdfsdk/fsdk_filewriteadapter.h
index f2c3a534bf..5e9eaabea6 100644
--- a/fpdfsdk/fsdk_filewriteadapter.h
+++ b/fpdfsdk/fsdk_filewriteadapter.h
@@ -17,7 +17,7 @@ class FSDK_FileWriteAdapter : public IFX_WriteStream {
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
bool WriteBlock(const void* data, size_t size) override;
- bool WriteString(const CFX_ByteStringC& str) override;
+ bool WriteString(const ByteStringView& str) override;
private:
explicit FSDK_FileWriteAdapter(FPDF_FILEWRITE* fileWriteStruct);
diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h
index b7f7cbe7f8..bffeac658b 100644
--- a/fpdfsdk/ipdfsdk_annothandler.h
+++ b/fpdfsdk/ipdfsdk_annothandler.h
@@ -35,9 +35,9 @@ class IPDFSDK_AnnotHandler {
virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0;
virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) = 0;
- virtual CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) = 0;
+ virtual WideString GetSelectedText(CPDFSDK_Annot* pAnnot) = 0;
virtual void ReplaceSelection(CPDFSDK_Annot* pAnnot,
- const CFX_WideString& text) = 0;
+ const WideString& text) = 0;
virtual bool HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
const CFX_PointF& point) = 0;
diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp
index 41c71ec411..9cc5d0ff1a 100644
--- a/fpdfsdk/javascript/Annot.cpp
+++ b/fpdfsdk/javascript/Annot.cpp
@@ -37,7 +37,7 @@ Annot::~Annot() {}
bool Annot::hidden(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
if (!m_pAnnot) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -71,9 +71,7 @@ bool Annot::hidden(CJS_Runtime* pRuntime,
return true;
}
-bool Annot::name(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Annot::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (vp.IsGetting()) {
if (!m_pAnnot) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -83,7 +81,7 @@ bool Annot::name(CJS_Runtime* pRuntime,
return true;
}
- CFX_WideString annotName;
+ WideString annotName;
vp >> annotName; // May invalidate m_pAnnot.
if (!m_pAnnot) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
@@ -94,9 +92,7 @@ bool Annot::name(CJS_Runtime* pRuntime,
return true;
}
-bool Annot::type(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Annot::type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
diff --git a/fpdfsdk/javascript/Annot.h b/fpdfsdk/javascript/Annot.h
index d9757fa514..d70f96a179 100644
--- a/fpdfsdk/javascript/Annot.h
+++ b/fpdfsdk/javascript/Annot.h
@@ -17,9 +17,9 @@ class Annot : public CJS_EmbedObj {
explicit Annot(CJS_Object* pJSObject);
~Annot() override;
- bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
void SetSDKAnnot(CPDFSDK_BAAnnot* annot);
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 77f67b5c8f..0c611c1211 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -164,7 +164,7 @@ Document::~Document() {
// the total number of fileds in document.
bool Document::numFields(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -175,13 +175,13 @@ bool Document::numFields(CJS_Runtime* pRuntime,
}
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
- vp << static_cast<int>(pPDFForm->CountFields(CFX_WideString()));
+ vp << static_cast<int>(pPDFForm->CountFields(WideString()));
return true;
}
bool Document::dirty(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -202,7 +202,7 @@ bool Document::dirty(CJS_Runtime* pRuntime,
bool Document::ADBE(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting())
vp.GetJSValue()->SetNull(pRuntime);
@@ -211,7 +211,7 @@ bool Document::ADBE(CJS_Runtime* pRuntime,
bool Document::pageNum(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -237,7 +237,7 @@ bool Document::pageNum(CJS_Runtime* pRuntime,
bool Document::addAnnot(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Not supported.
return true;
}
@@ -245,7 +245,7 @@ bool Document::addAnnot(CJS_Runtime* pRuntime,
bool Document::addField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Not supported.
return true;
}
@@ -253,7 +253,7 @@ bool Document::addField(CJS_Runtime* pRuntime,
bool Document::exportAsText(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -261,7 +261,7 @@ bool Document::exportAsText(CJS_Runtime* pRuntime,
bool Document::exportAsFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -269,7 +269,7 @@ bool Document::exportAsFDF(CJS_Runtime* pRuntime,
bool Document::exportAsXFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -277,7 +277,7 @@ bool Document::exportAsXFDF(CJS_Runtime* pRuntime,
bool Document::getField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -286,7 +286,7 @@ bool Document::getField(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
}
- CFX_WideString wideName = params[0].ToCFXWideString(pRuntime);
+ WideString wideName = params[0].ToCFXWideString(pRuntime);
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
if (pPDFForm->CountFields(wideName) <= 0) {
@@ -311,7 +311,7 @@ bool Document::getField(CJS_Runtime* pRuntime,
bool Document::getNthFieldName(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -327,7 +327,7 @@ bool Document::getNthFieldName(CJS_Runtime* pRuntime,
}
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
- CPDF_FormField* pField = pPDFForm->GetField(nIndex, CFX_WideString());
+ CPDF_FormField* pField = pPDFForm->GetField(nIndex, WideString());
if (!pField)
return false;
@@ -338,7 +338,7 @@ bool Document::getNthFieldName(CJS_Runtime* pRuntime,
bool Document::importAnFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -346,7 +346,7 @@ bool Document::importAnFDF(CJS_Runtime* pRuntime,
bool Document::importAnXFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -354,7 +354,7 @@ bool Document::importAnXFDF(CJS_Runtime* pRuntime,
bool Document::importTextData(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -365,7 +365,7 @@ bool Document::importTextData(CJS_Runtime* pRuntime,
bool Document::mailForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -376,14 +376,13 @@ bool Document::mailForm(CJS_Runtime* pRuntime,
}
int iLength = params.size();
bool bUI = iLength > 0 ? params[0].ToBool(pRuntime) : true;
- CFX_WideString cTo = iLength > 1 ? params[1].ToCFXWideString(pRuntime) : L"";
- CFX_WideString cCc = iLength > 2 ? params[2].ToCFXWideString(pRuntime) : L"";
- CFX_WideString cBcc = iLength > 3 ? params[3].ToCFXWideString(pRuntime) : L"";
- CFX_WideString cSubject =
- iLength > 4 ? params[4].ToCFXWideString(pRuntime) : L"";
- CFX_WideString cMsg = iLength > 5 ? params[5].ToCFXWideString(pRuntime) : L"";
+ WideString cTo = iLength > 1 ? params[1].ToCFXWideString(pRuntime) : L"";
+ WideString cCc = iLength > 2 ? params[2].ToCFXWideString(pRuntime) : L"";
+ WideString cBcc = iLength > 3 ? params[3].ToCFXWideString(pRuntime) : L"";
+ WideString cSubject = iLength > 4 ? params[4].ToCFXWideString(pRuntime) : L"";
+ WideString cMsg = iLength > 5 ? params[5].ToCFXWideString(pRuntime) : L"";
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
- CFX_ByteString sTextBuf = pInterForm->ExportFormToFDFTextBuf();
+ ByteString sTextBuf = pInterForm->ExportFormToFDFTextBuf();
if (sTextBuf.GetLength() == 0)
return false;
@@ -404,7 +403,7 @@ bool Document::mailForm(CJS_Runtime* pRuntime,
bool Document::print(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -472,7 +471,7 @@ bool Document::print(CJS_Runtime* pRuntime,
bool Document::removeField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -486,7 +485,7 @@ bool Document::removeField(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
return false;
}
- CFX_WideString sFieldName = params[0].ToCFXWideString(pRuntime);
+ WideString sFieldName = params[0].ToCFXWideString(pRuntime);
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
std::vector<CPDFSDK_Annot::ObservedPtr> widgets;
pInterForm->GetWidgets(sFieldName, &widgets);
@@ -531,7 +530,7 @@ bool Document::removeField(CJS_Runtime* pRuntime,
bool Document::resetForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -566,7 +565,7 @@ bool Document::resetForm(CJS_Runtime* pRuntime,
for (int i = 0, isz = aName.GetLength(pRuntime); i < isz; ++i) {
CJS_Value valElement(pRuntime);
aName.GetElement(pRuntime, i, valElement);
- CFX_WideString swVal = valElement.ToCFXWideString(pRuntime);
+ WideString swVal = valElement.ToCFXWideString(pRuntime);
for (int j = 0, jsz = pPDFForm->CountFields(swVal); j < jsz; ++j)
aFields.push_back(pPDFForm->GetField(j, swVal));
}
@@ -582,7 +581,7 @@ bool Document::resetForm(CJS_Runtime* pRuntime,
bool Document::saveAs(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -590,14 +589,14 @@ bool Document::saveAs(CJS_Runtime* pRuntime,
bool Document::syncAnnotScan(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::submitForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int nSize = params.size();
if (nSize < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
@@ -609,7 +608,7 @@ bool Document::submitForm(CJS_Runtime* pRuntime,
}
CJS_Array aFields;
- CFX_WideString strURL;
+ WideString strURL;
bool bFDF = true;
bool bEmpty = false;
CJS_Value v = params[0];
@@ -653,7 +652,7 @@ bool Document::submitForm(CJS_Runtime* pRuntime,
CJS_Value valName(pRuntime);
aFields.GetElement(pRuntime, i, valName);
- CFX_WideString sName = valName.ToCFXWideString(pRuntime);
+ WideString sName = valName.ToCFXWideString(pRuntime);
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
for (int j = 0, jsz = pPDFForm->CountFields(sName); j < jsz; ++j) {
CPDF_FormField* pField = pPDFForm->GetField(j, sName);
@@ -678,21 +677,21 @@ void Document::SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
bool Document::bookmarkRoot(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::mailDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// TODO(tsepez): Check maximum number of allowed params.
bool bUI = true;
- CFX_WideString cTo = L"";
- CFX_WideString cCc = L"";
- CFX_WideString cBcc = L"";
- CFX_WideString cSubject = L"";
- CFX_WideString cMsg = L"";
+ WideString cTo = L"";
+ WideString cCc = L"";
+ WideString cBcc = L"";
+ WideString cSubject = L"";
+ WideString cMsg = L"";
if (params.size() >= 1)
bUI = params[0].ToBool(pRuntime);
@@ -739,13 +738,13 @@ bool Document::mailDoc(CJS_Runtime* pRuntime,
bool Document::author(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Author", sError);
}
bool Document::info(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -758,46 +757,46 @@ bool Document::info(CJS_Runtime* pRuntime,
if (!pDictionary)
return false;
- CFX_WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author");
- CFX_WideString cwTitle = pDictionary->GetUnicodeTextFor("Title");
- CFX_WideString cwSubject = pDictionary->GetUnicodeTextFor("Subject");
- CFX_WideString cwKeywords = pDictionary->GetUnicodeTextFor("Keywords");
- CFX_WideString cwCreator = pDictionary->GetUnicodeTextFor("Creator");
- CFX_WideString cwProducer = pDictionary->GetUnicodeTextFor("Producer");
- CFX_WideString cwCreationDate =
- pDictionary->GetUnicodeTextFor("CreationDate");
- CFX_WideString cwModDate = pDictionary->GetUnicodeTextFor("ModDate");
- CFX_WideString cwTrapped = pDictionary->GetUnicodeTextFor("Trapped");
+ WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author");
+ WideString cwTitle = pDictionary->GetUnicodeTextFor("Title");
+ WideString cwSubject = pDictionary->GetUnicodeTextFor("Subject");
+ WideString cwKeywords = pDictionary->GetUnicodeTextFor("Keywords");
+ WideString cwCreator = pDictionary->GetUnicodeTextFor("Creator");
+ WideString cwProducer = pDictionary->GetUnicodeTextFor("Producer");
+ WideString cwCreationDate = pDictionary->GetUnicodeTextFor("CreationDate");
+ WideString cwModDate = pDictionary->GetUnicodeTextFor("ModDate");
+ WideString cwTrapped = pDictionary->GetUnicodeTextFor("Trapped");
v8::Local<v8::Object> pObj = pRuntime->NewFxDynamicObj(-1);
pRuntime->PutObjectProperty(pObj, L"Author",
- pRuntime->NewString(cwAuthor.AsStringC()));
+ pRuntime->NewString(cwAuthor.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Title",
- pRuntime->NewString(cwTitle.AsStringC()));
+ pRuntime->NewString(cwTitle.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Subject",
- pRuntime->NewString(cwSubject.AsStringC()));
+ pRuntime->NewString(cwSubject.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Keywords",
- pRuntime->NewString(cwKeywords.AsStringC()));
+ pRuntime->NewString(cwKeywords.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Creator",
- pRuntime->NewString(cwCreator.AsStringC()));
+ pRuntime->NewString(cwCreator.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Producer",
- pRuntime->NewString(cwProducer.AsStringC()));
- pRuntime->PutObjectProperty(pObj, L"CreationDate",
- pRuntime->NewString(cwCreationDate.AsStringC()));
+ pRuntime->NewString(cwProducer.AsStringView()));
+ pRuntime->PutObjectProperty(
+ pObj, L"CreationDate",
+ pRuntime->NewString(cwCreationDate.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"ModDate",
- pRuntime->NewString(cwModDate.AsStringC()));
+ pRuntime->NewString(cwModDate.AsStringView()));
pRuntime->PutObjectProperty(pObj, L"Trapped",
- pRuntime->NewString(cwTrapped.AsStringC()));
+ pRuntime->NewString(cwTrapped.AsStringView()));
// It's to be compatible to non-standard info dictionary.
for (const auto& it : *pDictionary) {
- const CFX_ByteString& bsKey = it.first;
+ const ByteString& bsKey = it.first;
CPDF_Object* pValueObj = it.second.get();
- CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey.AsStringC());
+ WideString wsKey = WideString::FromUTF8(bsKey.AsStringView());
if (pValueObj->IsString() || pValueObj->IsName()) {
pRuntime->PutObjectProperty(
pObj, wsKey,
- pRuntime->NewString(pValueObj->GetUnicodeText().AsStringC()));
+ pRuntime->NewString(pValueObj->GetUnicodeText().AsStringView()));
} else if (pValueObj->IsNumber()) {
pRuntime->PutObjectProperty(pObj, wsKey,
pRuntime->NewNumber(pValueObj->GetNumber()));
@@ -812,8 +811,8 @@ bool Document::info(CJS_Runtime* pRuntime,
bool Document::getPropertyInternal(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- const CFX_ByteString& propName,
- CFX_WideString& sError) {
+ const ByteString& propName,
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -829,7 +828,7 @@ bool Document::getPropertyInternal(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
return false;
}
- CFX_WideString csProperty;
+ WideString csProperty;
vp >> csProperty;
pDictionary->SetNewFor<CPDF_String>(propName, PDF_EncodeText(csProperty),
false);
@@ -840,19 +839,19 @@ bool Document::getPropertyInternal(CJS_Runtime* pRuntime,
bool Document::creationDate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "CreationDate", sError);
}
bool Document::creator(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Creator", sError);
}
bool Document::delay(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -880,31 +879,31 @@ bool Document::delay(CJS_Runtime* pRuntime,
bool Document::keywords(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Keywords", sError);
}
bool Document::modDate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "ModDate", sError);
}
bool Document::producer(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Producer", sError);
}
bool Document::subject(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return getPropertyInternal(pRuntime, vp, "Subject", sError);
}
bool Document::title(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv || !m_pFormFillEnv->GetUnderlyingDocument()) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -914,7 +913,7 @@ bool Document::title(CJS_Runtime* pRuntime,
bool Document::numPages(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -929,7 +928,7 @@ bool Document::numPages(CJS_Runtime* pRuntime,
bool Document::external(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
// In Chrome case, should always return true.
if (vp.IsGetting()) {
vp << true;
@@ -939,7 +938,7 @@ bool Document::external(CJS_Runtime* pRuntime,
bool Document::filesize(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -950,19 +949,19 @@ bool Document::filesize(CJS_Runtime* pRuntime,
bool Document::mouseX(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::mouseY(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::URL(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -977,7 +976,7 @@ bool Document::URL(CJS_Runtime* pRuntime,
bool Document::baseURL(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << m_cwBaseURL;
} else {
@@ -988,7 +987,7 @@ bool Document::baseURL(CJS_Runtime* pRuntime,
bool Document::calculate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1006,7 +1005,7 @@ bool Document::calculate(CJS_Runtime* pRuntime,
bool Document::documentFileName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1015,7 +1014,7 @@ bool Document::documentFileName(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
}
- CFX_WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath();
+ WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath();
FX_STRSIZE i = wsFilePath.GetLength();
for (; i > 0; i--) {
if (wsFilePath[i - 1] == L'\\' || wsFilePath[i - 1] == L'/')
@@ -1032,7 +1031,7 @@ bool Document::documentFileName(CJS_Runtime* pRuntime,
bool Document::path(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1047,41 +1046,41 @@ bool Document::path(CJS_Runtime* pRuntime,
bool Document::pageWindowRect(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::layout(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::addLink(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::closeDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getPageBox(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getAnnot(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1091,7 +1090,7 @@ bool Document::getAnnot(CJS_Runtime* pRuntime,
return false;
}
int nPageNo = params[0].ToInt(pRuntime);
- CFX_WideString swAnnotName = params[1].ToCFXWideString(pRuntime);
+ WideString swAnnotName = params[1].ToCFXWideString(pRuntime);
CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(nPageNo);
if (!pPageView)
return false;
@@ -1125,7 +1124,7 @@ bool Document::getAnnot(CJS_Runtime* pRuntime,
bool Document::getAnnots(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1166,7 +1165,7 @@ bool Document::getAnnots(CJS_Runtime* pRuntime,
bool Document::getAnnot3D(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
vRet.SetNull(pRuntime);
return true;
}
@@ -1174,21 +1173,21 @@ bool Document::getAnnot3D(CJS_Runtime* pRuntime,
bool Document::getAnnots3D(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getOCGs(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getLinks(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
@@ -1200,13 +1199,13 @@ bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) {
bool Document::addIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime);
+ WideString swIconName = params[0].ToCFXWideString(pRuntime);
if (params[1].GetType() != CJS_Value::VT_object) {
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
return false;
@@ -1229,7 +1228,7 @@ bool Document::addIcon(CJS_Runtime* pRuntime,
bool Document::icons(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1261,13 +1260,13 @@ bool Document::icons(CJS_Runtime* pRuntime,
bool Document::getIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime);
+ WideString swIconName = params[0].ToCFXWideString(pRuntime);
auto it = std::find(m_IconNames.begin(), m_IconNames.end(), swIconName);
if (it == m_IconNames.end())
return false;
@@ -1287,7 +1286,7 @@ bool Document::getIcon(CJS_Runtime* pRuntime,
bool Document::removeIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, no supported.
return true;
}
@@ -1295,21 +1294,21 @@ bool Document::removeIcon(CJS_Runtime* pRuntime,
bool Document::createDataObject(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not implemented.
return true;
}
bool Document::media(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::calculateNow(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1326,14 +1325,14 @@ bool Document::calculateNow(CJS_Runtime* pRuntime,
bool Document::Collab(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::getPageNthWord(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1366,7 +1365,7 @@ bool Document::getPageNthWord(CJS_Runtime* pRuntime,
page.ParseContent();
int nWords = 0;
- CFX_WideString swRet;
+ WideString swRet;
for (auto& pPageObj : *page.GetPageObjectList()) {
if (pPageObj->IsText()) {
CPDF_TextObject* pTextObj = pPageObj->AsText();
@@ -1391,7 +1390,7 @@ bool Document::getPageNthWord(CJS_Runtime* pRuntime,
bool Document::getPageNthWordQuads(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1406,7 +1405,7 @@ bool Document::getPageNthWordQuads(CJS_Runtime* pRuntime,
bool Document::getPageNumWords(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
@@ -1442,7 +1441,7 @@ bool Document::getPageNumWords(CJS_Runtime* pRuntime,
bool Document::getPrintParams(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
v8::Local<v8::Object> pRetObj =
pRuntime->NewFxDynamicObj(CJS_PrintParamsObj::g_nObjDefnID);
if (pRetObj.IsEmpty())
@@ -1473,7 +1472,7 @@ int Document::CountWords(CPDF_TextObject* pTextObj) {
float kerning;
pTextObj->GetCharInfo(i, &charcode, &kerning);
- CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
+ WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
uint16_t unicode = 0;
if (swUnicode.GetLength() > 0)
@@ -1490,9 +1489,8 @@ int Document::CountWords(CPDF_TextObject* pTextObj) {
return nWords;
}
-CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj,
- int nWordIndex) {
- CFX_WideString swRet;
+WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex) {
+ WideString swRet;
CPDF_Font* pFont = pTextObj->GetFont();
if (!pFont)
@@ -1506,7 +1504,7 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj,
float kerning;
pTextObj->GetCharInfo(i, &charcode, &kerning);
- CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
+ WideString swUnicode = pFont->UnicodeFromCharCode(charcode);
uint16_t unicode = 0;
if (swUnicode.GetLength() > 0)
@@ -1528,7 +1526,7 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj,
bool Document::zoom(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
@@ -1544,14 +1542,14 @@ bool Document::zoom(CJS_Runtime* pRuntime,
bool Document::zoomType(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Document::deletePages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, no supported.
return true;
}
@@ -1559,7 +1557,7 @@ bool Document::deletePages(CJS_Runtime* pRuntime,
bool Document::extractPages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -1567,7 +1565,7 @@ bool Document::extractPages(CJS_Runtime* pRuntime,
bool Document::insertPages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -1575,7 +1573,7 @@ bool Document::insertPages(CJS_Runtime* pRuntime,
bool Document::replacePages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -1583,7 +1581,7 @@ bool Document::replacePages(CJS_Runtime* pRuntime,
bool Document::getURL(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -1591,7 +1589,7 @@ bool Document::getURL(CJS_Runtime* pRuntime,
bool Document::gotoNamedDest(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1600,7 +1598,7 @@ bool Document::gotoNamedDest(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
return false;
}
- CFX_WideString wideName = params[0].ToCFXWideString(pRuntime);
+ WideString wideName = params[0].ToCFXWideString(pRuntime);
CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
if (!pDocument)
return false;
@@ -1629,8 +1627,7 @@ void Document::AddDelayData(CJS_DelayData* pData) {
m_DelayData.push_back(std::unique_ptr<CJS_DelayData>(pData));
}
-void Document::DoFieldDelay(const CFX_WideString& sFieldName,
- int nControlIndex) {
+void Document::DoFieldDelay(const WideString& sFieldName, int nControlIndex) {
std::vector<std::unique_ptr<CJS_DelayData>> DelayDataForFieldAndControlIndex;
auto iter = m_DelayData.begin();
while (iter != m_DelayData.end()) {
diff --git a/fpdfsdk/javascript/Document.h b/fpdfsdk/javascript/Document.h
index 91ca778c79..3cec9fa4bc 100644
--- a/fpdfsdk/javascript/Document.h
+++ b/fpdfsdk/javascript/Document.h
@@ -50,265 +50,239 @@ class Document : public CJS_EmbedObj {
explicit Document(CJS_Object* pJSObject);
~Document() override;
- bool ADBE(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool author(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool baseURL(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ bool ADBE(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool author(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool baseURL(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool bookmarkRoot(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool calculate(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool Collab(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool calculate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool Collab(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool creationDate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool creator(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool dirty(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool creator(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool dirty(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool documentFileName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool external(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool filesize(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool icons(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool info(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool keywords(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool layout(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool modDate(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool mouseX(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool mouseY(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool numFields(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool numPages(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool pageNum(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool external(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool filesize(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool icons(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool info(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool keywords(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool layout(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool modDate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool mouseX(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool mouseY(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool numFields(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool numPages(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool pageNum(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool pageWindowRect(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool path(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool producer(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool subject(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool title(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool zoom(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool zoomType(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool path(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool producer(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool subject(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool title(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool zoom(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool zoomType(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool addAnnot(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool addField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool addLink(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool addIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool calculateNow(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool closeDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool createDataObject(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool deletePages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool exportAsText(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool exportAsFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool exportAsXFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool extractPages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getAnnot(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getAnnots(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getAnnot3D(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getAnnots3D(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getLinks(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getNthFieldName(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getOCGs(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPageBox(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPageNthWord(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPageNthWordQuads(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPageNumWords(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getPrintParams(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getURL(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool gotoNamedDest(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool importAnFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool importAnXFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool importTextData(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool insertPages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool mailForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool print(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool removeField(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool replacePages(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool resetForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool saveAs(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool submitForm(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool syncAnnotScan(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool mailDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool removeIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
- bool URL(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool URL(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv);
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const {
return m_pFormFillEnv.Get();
}
void AddDelayData(CJS_DelayData* pData);
- void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
+ void DoFieldDelay(const WideString& sFieldName, int nControlIndex);
CJS_Document* GetCJSDoc() const;
private:
bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
int CountWords(CPDF_TextObject* pTextObj);
- CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
+ WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
bool getPropertyInternal(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- const CFX_ByteString& propName,
- CFX_WideString& sError);
+ const ByteString& propName,
+ WideString& sError);
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
- CFX_WideString m_cwBaseURL;
+ WideString m_cwBaseURL;
std::list<std::unique_ptr<CJS_DelayData>> m_DelayData;
// Needs to be a std::list for iterator stability.
- std::list<CFX_WideString> m_IconNames;
+ std::list<WideString> m_IconNames;
bool m_bDelay;
};
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 32d44774ff..fa5d478555 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -163,9 +163,7 @@ JSMethodSpec CJS_Field::MethodSpecs[] = {
IMPLEMENT_JS_CLASS(CJS_Field, Field)
-CJS_DelayData::CJS_DelayData(FIELD_PROP prop,
- int idx,
- const CFX_WideString& name)
+CJS_DelayData::CJS_DelayData(FIELD_PROP prop, int idx, const WideString& name)
: eProp(prop), nControlIndex(idx), sFieldName(name) {}
CJS_DelayData::~CJS_DelayData() {}
@@ -210,8 +208,7 @@ void Field::ParseFieldName(const std::wstring& strFieldNameParsed,
strFieldName = strFieldNameParsed.substr(0, iStart);
}
-bool Field::AttachField(Document* pDocument,
- const CFX_WideString& csFieldName) {
+bool Field::AttachField(Document* pDocument, const WideString& csFieldName) {
m_pJSDoc = pDocument;
m_pFormFillEnv.Reset(pDocument->GetFormFillEnv());
m_bCanSet = m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM) ||
@@ -220,7 +217,7 @@ bool Field::AttachField(Document* pDocument,
CPDFSDK_InterForm* pRDInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
- CFX_WideString swFieldNameTemp = csFieldName;
+ WideString swFieldNameTemp = csFieldName;
swFieldNameTemp.Replace(L"..", L".");
if (pInterForm->CountFields(swFieldNameTemp) <= 0) {
@@ -243,7 +240,7 @@ bool Field::AttachField(Document* pDocument,
std::vector<CPDF_FormField*> Field::GetFormFields(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& csFieldName) {
+ const WideString& csFieldName) {
std::vector<CPDF_FormField*> fields;
CPDFSDK_InterForm* pReaderInterForm = pFormFillEnv->GetInterForm();
CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm();
@@ -255,7 +252,7 @@ std::vector<CPDF_FormField*> Field::GetFormFields(
}
std::vector<CPDF_FormField*> Field::GetFormFields(
- const CFX_WideString& csFieldName) const {
+ const WideString& csFieldName) const {
return Field::GetFormFields(m_pFormFillEnv.Get(), csFieldName);
}
@@ -275,8 +272,8 @@ void Field::UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
for (auto& pObserved : widgets) {
if (pObserved) {
bool bFormatted = false;
- CFX_WideString sValue = static_cast<CPDFSDK_Widget*>(pObserved.Get())
- ->OnFormat(bFormatted);
+ WideString sValue = static_cast<CPDFSDK_Widget*>(pObserved.Get())
+ ->OnFormat(bFormatted);
if (pObserved) { // Not redundant, may be clobbered by OnFormat.
static_cast<CPDFSDK_Widget*>(pObserved.Get())
->ResetAppearance(bFormatted ? &sValue : nullptr, false);
@@ -332,7 +329,7 @@ void Field::UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv,
if (nFieldType == FIELDTYPE_COMBOBOX ||
nFieldType == FIELDTYPE_TEXTFIELD) {
bool bFormatted = false;
- CFX_WideString sValue = pWidget->OnFormat(bFormatted);
+ WideString sValue = pWidget->OnFormat(bFormatted);
pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, false);
} else {
pWidget->ResetAppearance(nullptr, false);
@@ -356,8 +353,7 @@ CPDFSDK_Widget* Field::GetWidget(CPDFSDK_FormFillEnvironment* pFormFillEnv,
return pInterForm ? pInterForm->GetWidget(pFormControl) : nullptr;
}
-bool Field::ValueIsOccur(CPDF_FormField* pFormField,
- CFX_WideString csOptLabel) {
+bool Field::ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel) {
for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) {
if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0)
return true;
@@ -379,14 +375,14 @@ CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) {
bool Field::alignment(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString alignStr;
+ ByteString alignStr;
vp >> alignStr;
if (m_bDelay) {
@@ -427,22 +423,22 @@ bool Field::alignment(CJS_Runtime* pRuntime,
}
void Field::SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
// Not supported.
}
bool Field::borderStyle(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString strType = "";
+ ByteString strType = "";
vp >> strType;
if (m_bDelay) {
@@ -491,9 +487,9 @@ bool Field::borderStyle(CJS_Runtime* pRuntime,
}
void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
ASSERT(pFormFillEnv);
BorderStyle nBorderStyle = BorderStyle::SOLID;
@@ -544,7 +540,7 @@ void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::buttonAlignX(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -585,7 +581,7 @@ bool Field::buttonAlignX(CJS_Runtime* pRuntime,
}
void Field::SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -593,7 +589,7 @@ void Field::SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::buttonAlignY(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -634,7 +630,7 @@ bool Field::buttonAlignY(CJS_Runtime* pRuntime,
}
void Field::SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -642,7 +638,7 @@ void Field::SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::buttonFitBounds(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -678,7 +674,7 @@ bool Field::buttonFitBounds(CJS_Runtime* pRuntime,
}
void Field::SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -686,7 +682,7 @@ void Field::SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::buttonPosition(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -721,7 +717,7 @@ bool Field::buttonPosition(CJS_Runtime* pRuntime,
}
void Field::SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -729,7 +725,7 @@ void Field::SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::buttonScaleHow(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -769,7 +765,7 @@ bool Field::buttonScaleHow(CJS_Runtime* pRuntime,
}
void Field::SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -777,7 +773,7 @@ void Field::SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::buttonScaleWhen(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -828,7 +824,7 @@ bool Field::buttonScaleWhen(CJS_Runtime* pRuntime,
}
void Field::SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -836,7 +832,7 @@ void Field::SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::calcOrderIndex(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -872,7 +868,7 @@ bool Field::calcOrderIndex(CJS_Runtime* pRuntime,
}
void Field::SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -880,7 +876,7 @@ void Field::SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::charLimit(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -911,15 +907,13 @@ bool Field::charLimit(CJS_Runtime* pRuntime,
}
void Field::SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
}
-bool Field::comb(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::comb(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -954,7 +948,7 @@ bool Field::comb(CJS_Runtime* pRuntime,
}
void Field::SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -962,7 +956,7 @@ void Field::SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::commitOnSelChange(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -999,7 +993,7 @@ bool Field::commitOnSelChange(CJS_Runtime* pRuntime,
}
void Field::SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -1007,7 +1001,7 @@ void Field::SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::currentValueIndices(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1064,7 +1058,7 @@ bool Field::currentValueIndices(CJS_Runtime* pRuntime,
}
void Field::SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const std::vector<uint32_t>& array) {
ASSERT(pFormFillEnv);
@@ -1091,26 +1085,26 @@ void Field::SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::defaultStyle(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
void Field::SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex) {
// Not supported.
}
bool Field::defaultValue(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_WideString WideStr;
+ WideString WideStr;
vp >> WideStr;
if (m_bDelay) {
@@ -1136,15 +1130,15 @@ bool Field::defaultValue(CJS_Runtime* pRuntime,
}
void Field::SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_WideString& string) {
+ const WideString& string) {
// Not supported.
}
bool Field::doNotScroll(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -1179,7 +1173,7 @@ bool Field::doNotScroll(CJS_Runtime* pRuntime,
}
void Field::SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -1187,7 +1181,7 @@ void Field::SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::doNotSpellCheck(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -1227,7 +1221,7 @@ void Field::SetDelay(bool bDelay) {
bool Field::delay(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsSetting()) {
vp << m_bDelay;
return true;
@@ -1243,7 +1237,7 @@ bool Field::delay(CJS_Runtime* pRuntime,
bool Field::display(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1288,7 +1282,7 @@ bool Field::display(CJS_Runtime* pRuntime,
}
void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
@@ -1323,9 +1317,7 @@ void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
}
}
-bool Field::doc(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::doc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -1335,7 +1327,7 @@ bool Field::doc(CJS_Runtime* pRuntime,
bool Field::editable(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1358,7 +1350,7 @@ bool Field::editable(CJS_Runtime* pRuntime,
bool Field::exportValues(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -1398,7 +1390,7 @@ bool Field::exportValues(CJS_Runtime* pRuntime,
bool Field::fileSelect(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -1421,7 +1413,7 @@ bool Field::fileSelect(CJS_Runtime* pRuntime,
bool Field::fillColor(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_Array crArray;
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -1481,7 +1473,7 @@ bool Field::fillColor(CJS_Runtime* pRuntime,
}
void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color) {
// Not supported.
@@ -1489,7 +1481,7 @@ void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::hidden(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1526,7 +1518,7 @@ bool Field::hidden(CJS_Runtime* pRuntime,
}
void Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
int display = b ? 1 /*Hidden*/ : 0 /*Visible*/;
@@ -1535,13 +1527,13 @@ void Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::highlight(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString strMode;
+ ByteString strMode;
vp >> strMode;
if (m_bDelay) {
@@ -1586,15 +1578,15 @@ bool Field::highlight(CJS_Runtime* pRuntime,
}
void Field::SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
// Not supported.
}
bool Field::lineWidth(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
@@ -1633,7 +1625,7 @@ bool Field::lineWidth(CJS_Runtime* pRuntime,
}
void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
@@ -1673,7 +1665,7 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::multiline(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -1708,7 +1700,7 @@ bool Field::multiline(CJS_Runtime* pRuntime,
}
void Field::SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -1716,7 +1708,7 @@ void Field::SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::multipleSelection(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1745,15 +1737,13 @@ bool Field::multipleSelection(CJS_Runtime* pRuntime,
}
void Field::SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
}
-bool Field::name(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -1767,7 +1757,7 @@ bool Field::name(CJS_Runtime* pRuntime,
bool Field::numItems(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -1785,9 +1775,7 @@ bool Field::numItems(CJS_Runtime* pRuntime,
return true;
}
-bool Field::page(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::page(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
return false;
@@ -1832,7 +1820,7 @@ bool Field::page(CJS_Runtime* pRuntime,
bool Field::password(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -1863,7 +1851,7 @@ bool Field::password(CJS_Runtime* pRuntime,
}
void Field::SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b) {
// Not supported.
@@ -1871,7 +1859,7 @@ void Field::SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::print(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
@@ -1942,7 +1930,7 @@ bool Field::print(CJS_Runtime* pRuntime,
bool Field::radiosInUnison(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -1965,7 +1953,7 @@ bool Field::radiosInUnison(CJS_Runtime* pRuntime,
bool Field::readonly(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -1982,9 +1970,7 @@ bool Field::readonly(CJS_Runtime* pRuntime,
return true;
}
-bool Field::rect(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::rect(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
CJS_Value Upper_Leftx(pRuntime);
CJS_Value Upper_Lefty(pRuntime);
CJS_Value Lower_Rightx(pRuntime);
@@ -2045,7 +2031,7 @@ bool Field::rect(CJS_Runtime* pRuntime,
}
void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_FloatRect& rect) {
CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
@@ -2104,7 +2090,7 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::required(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -2127,7 +2113,7 @@ bool Field::required(CJS_Runtime* pRuntime,
bool Field::richText(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -2156,13 +2142,13 @@ bool Field::richText(CJS_Runtime* pRuntime,
bool Field::richValue(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::rotation(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -2193,7 +2179,7 @@ bool Field::rotation(CJS_Runtime* pRuntime,
}
void Field::SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
@@ -2201,7 +2187,7 @@ void Field::SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::strokeColor(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_Array crArray;
if (vp.IsSetting()) {
@@ -2259,7 +2245,7 @@ bool Field::strokeColor(CJS_Runtime* pRuntime,
}
void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color) {
// Not supported.
@@ -2267,14 +2253,14 @@ void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::style(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString csBCaption;
+ ByteString csBCaption;
vp >> csBCaption;
if (m_bDelay) {
@@ -2299,8 +2285,8 @@ bool Field::style(CJS_Runtime* pRuntime,
if (!pFormControl)
return false;
- CFX_WideString csWCaption = pFormControl->GetNormalCaption();
- CFX_ByteString csBCaption;
+ WideString csWCaption = pFormControl->GetNormalCaption();
+ ByteString csBCaption;
switch (csWCaption[0]) {
case L'l':
@@ -2327,21 +2313,21 @@ bool Field::style(CJS_Runtime* pRuntime,
}
void Field::SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
// Not supported.
}
bool Field::submitName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::textColor(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_Array crArray;
if (vp.IsSetting()) {
@@ -2395,7 +2381,7 @@ bool Field::textColor(CJS_Runtime* pRuntime,
}
void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color) {
// Not supported.
@@ -2403,14 +2389,14 @@ void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::textFont(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_ByteString csFontName;
+ ByteString csFontName;
vp >> csFontName;
if (csFontName.IsEmpty())
return false;
@@ -2447,15 +2433,15 @@ bool Field::textFont(CJS_Runtime* pRuntime,
}
void Field::SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string) {
+ const ByteString& string) {
// Not supported.
}
bool Field::textSize(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
@@ -2490,15 +2476,13 @@ bool Field::textSize(CJS_Runtime* pRuntime,
}
void Field::SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number) {
// Not supported.
}
-bool Field::type(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -2541,14 +2525,14 @@ bool Field::type(CJS_Runtime* pRuntime,
bool Field::userName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- CFX_WideString swName;
+ WideString swName;
vp >> swName;
if (m_bDelay) {
@@ -2568,20 +2552,20 @@ bool Field::userName(CJS_Runtime* pRuntime,
}
void Field::SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_WideString& string) {
+ const WideString& string) {
// Not supported.
}
bool Field::value(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
return false;
- std::vector<CFX_WideString> strArray;
+ std::vector<WideString> strArray;
if (vp.GetJSValue()->IsArrayObject()) {
CJS_Array ValueArray;
vp.GetJSValue()->ConvertToArray(pRuntime, ValueArray);
@@ -2591,7 +2575,7 @@ bool Field::value(CJS_Runtime* pRuntime,
strArray.push_back(ElementValue.ToCFXWideString(pRuntime));
}
} else {
- CFX_WideString swValue;
+ WideString swValue;
vp >> swValue;
strArray.push_back(swValue);
}
@@ -2660,9 +2644,9 @@ bool Field::value(CJS_Runtime* pRuntime,
}
void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const std::vector<CFX_WideString>& strArray) {
+ const std::vector<WideString>& strArray) {
ASSERT(pFormFillEnv);
if (strArray.empty())
return;
@@ -2715,7 +2699,7 @@ void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
bool Field::valueAsString(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -2758,7 +2742,7 @@ bool Field::valueAsString(CJS_Runtime* pRuntime,
bool Field::browseForFileToSubmit(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -2766,7 +2750,7 @@ bool Field::browseForFileToSubmit(CJS_Runtime* pRuntime,
CPDF_FormField* pFormField = FieldArray[0];
if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) &&
(pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) {
- CFX_WideString wsFileName = m_pFormFillEnv->JS_fieldBrowse();
+ WideString wsFileName = m_pFormFillEnv->JS_fieldBrowse();
if (!wsFileName.IsEmpty()) {
pFormField->SetValue(wsFileName);
UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true);
@@ -2779,7 +2763,7 @@ bool Field::browseForFileToSubmit(CJS_Runtime* pRuntime,
bool Field::buttonGetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int nface = 0;
int iSize = params.size();
if (iSize >= 1)
@@ -2812,7 +2796,7 @@ bool Field::buttonGetCaption(CJS_Runtime* pRuntime,
bool Field::buttonGetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() >= 1) {
int nFace = params[0].ToInt(pRuntime);
if (nFace < 0 || nFace > 2)
@@ -2844,28 +2828,28 @@ bool Field::buttonGetIcon(CJS_Runtime* pRuntime,
bool Field::buttonImportIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::buttonSetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::buttonSetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::checkThisBox(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int iSize = params.size();
if (iSize < 1)
return false;
@@ -2902,14 +2886,14 @@ bool Field::checkThisBox(CJS_Runtime* pRuntime,
bool Field::clearItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::defaultIsChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!m_bCanSet)
return false;
@@ -2936,28 +2920,27 @@ bool Field::defaultIsChecked(CJS_Runtime* pRuntime,
bool Field::deleteItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::getArray(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
- std::vector<std::unique_ptr<CFX_WideString>> swSort;
+ std::vector<std::unique_ptr<WideString>> swSort;
for (CPDF_FormField* pFormField : FieldArray) {
- swSort.push_back(std::unique_ptr<CFX_WideString>(
- new CFX_WideString(pFormField->GetFullName())));
+ swSort.push_back(
+ std::unique_ptr<WideString>(new WideString(pFormField->GetFullName())));
}
- std::sort(
- swSort.begin(), swSort.end(),
- [](const std::unique_ptr<CFX_WideString>& p1,
- const std::unique_ptr<CFX_WideString>& p2) { return *p1 < *p2; });
+ std::sort(swSort.begin(), swSort.end(),
+ [](const std::unique_ptr<WideString>& p1,
+ const std::unique_ptr<WideString>& p2) { return *p1 < *p2; });
CJS_Array FormFieldArray;
@@ -2982,7 +2965,7 @@ bool Field::getArray(CJS_Runtime* pRuntime,
bool Field::getItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int iSize = params.size();
int nIdx = -1;
if (iSize >= 1)
@@ -3002,7 +2985,7 @@ bool Field::getItemAt(CJS_Runtime* pRuntime,
if (nIdx == -1 || nIdx > pFormField->CountOptions())
nIdx = pFormField->CountOptions() - 1;
if (bExport) {
- CFX_WideString strval = pFormField->GetOptionValue(nIdx);
+ WideString strval = pFormField->GetOptionValue(nIdx);
if (strval.IsEmpty())
vRet = CJS_Value(pRuntime, pFormField->GetOptionLabel(nIdx).c_str());
else
@@ -3020,21 +3003,21 @@ bool Field::getItemAt(CJS_Runtime* pRuntime,
bool Field::getLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::insertItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::isBoxChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int nIndex = -1;
if (params.size() >= 1)
nIndex = params[0].ToInt(pRuntime);
@@ -3058,7 +3041,7 @@ bool Field::isBoxChecked(CJS_Runtime* pRuntime,
bool Field::isDefaultChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int nIndex = -1;
if (params.size() >= 1)
nIndex = params[0].ToInt(pRuntime);
@@ -3081,14 +3064,14 @@ bool Field::isDefaultChecked(CJS_Runtime* pRuntime,
bool Field::setAction(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::setFocus(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return false;
@@ -3133,62 +3116,62 @@ bool Field::setFocus(CJS_Runtime* pRuntime,
bool Field::setItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool Field::setLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureGetModifications(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureGetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureInfo(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureSetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureSign(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::signatureValidate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool Field::source(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << (CJS_Object*)nullptr;
}
@@ -3210,14 +3193,14 @@ void Field::AddDelay_Bool(FIELD_PROP prop, bool b) {
m_pJSDoc->AddDelayData(pNewData);
}
-void Field::AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string) {
+void Field::AddDelay_String(FIELD_PROP prop, const ByteString& string) {
CJS_DelayData* pNewData =
new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
pNewData->string = string;
m_pJSDoc->AddDelayData(pNewData);
}
-void Field::AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string) {
+void Field::AddDelay_WideString(FIELD_PROP prop, const WideString& string) {
CJS_DelayData* pNewData =
new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
pNewData->widestring = string;
@@ -3247,7 +3230,7 @@ void Field::AddDelay_WordArray(FIELD_PROP prop,
}
void Field::AddDelay_WideStringArray(FIELD_PROP prop,
- const std::vector<CFX_WideString>& array) {
+ const std::vector<WideString>& array) {
CJS_DelayData* pNewData =
new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
pNewData->widestringarray = array;
@@ -3397,7 +3380,7 @@ void Field::DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
void Field::AddField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
int nPageIndex,
int nFieldType,
- const CFX_WideString& sName,
+ const WideString& sName,
const CFX_FloatRect& rcCoords) {
// Not supported.
}
diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h
index 1c8d6beac1..2ca1da4491 100644
--- a/fpdfsdk/javascript/Field.h
+++ b/fpdfsdk/javascript/Field.h
@@ -56,20 +56,20 @@ enum FIELD_PROP {
};
struct CJS_DelayData {
- CJS_DelayData(FIELD_PROP prop, int idx, const CFX_WideString& name);
+ CJS_DelayData(FIELD_PROP prop, int idx, const WideString& name);
~CJS_DelayData();
FIELD_PROP eProp;
int nControlIndex;
- CFX_WideString sFieldName;
+ WideString sFieldName;
int32_t num;
bool b;
- CFX_ByteString string;
- CFX_WideString widestring;
+ ByteString string;
+ WideString widestring;
CFX_FloatRect rect;
CFX_Color color;
std::vector<uint32_t> wordarray;
- std::vector<CFX_WideString> widestringarray;
+ std::vector<WideString> widestringarray;
};
class Field : public CJS_EmbedObj {
@@ -77,380 +77,338 @@ class Field : public CJS_EmbedObj {
explicit Field(CJS_Object* pJSObject);
~Field() override;
- bool alignment(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ bool alignment(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool borderStyle(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonAlignX(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonAlignY(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonFitBounds(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonPosition(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonScaleHow(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonScaleWhen(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool calcOrderIndex(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool charLimit(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool comb(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool charLimit(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool comb(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool commitOnSelChange(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool currentValueIndices(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool defaultStyle(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool defaultValue(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool doNotScroll(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool doNotSpellCheck(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool display(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool doc(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool editable(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool display(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool doc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool editable(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool exportValues(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool fileSelect(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool fillColor(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool highlight(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool lineWidth(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool multiline(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool fileSelect(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool fillColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool highlight(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool lineWidth(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool multiline(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool multipleSelection(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool numItems(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool page(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool password(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool print(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool numItems(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool page(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool password(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool print(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool radiosInUnison(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool readonly(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool rect(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool required(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool richText(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool richValue(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool rotation(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool readonly(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool rect(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool required(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool richText(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool richValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool rotation(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool strokeColor(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool style(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool submitName(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool textColor(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool textFont(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool textSize(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool userName(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool style(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool submitName(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool textColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool textFont(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool textSize(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool userName(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool valueAsString(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool browseForFileToSubmit(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonGetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonGetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonImportIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonSetCaption(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool buttonSetIcon(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool checkThisBox(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool clearItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool defaultIsChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool deleteItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getArray(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool getLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool insertItemAt(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool isBoxChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool isDefaultChecked(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setAction(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setFocus(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setItems(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setLock(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureGetModifications(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureGetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureInfo(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureSetSeedValue(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureSign(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool signatureValidate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static void SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const std::vector<uint32_t>& array);
static void SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex);
static void SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_WideString& string);
+ const WideString& string);
static void SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color);
static void SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
bool b);
static void SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_FloatRect& rect);
static void SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color);
static void SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
const CFX_Color& color);
static void SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_ByteString& string);
+ const ByteString& string);
static void SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
int number);
static void SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const CFX_WideString& string);
+ const WideString& string);
static void SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& swFieldName,
+ const WideString& swFieldName,
int nControlIndex,
- const std::vector<CFX_WideString>& strArray);
+ const std::vector<WideString>& strArray);
static void AddField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
int nPageIndex,
int nFieldType,
- const CFX_WideString& sName,
+ const WideString& sName,
const CFX_FloatRect& rcCoords);
static void UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -468,12 +426,12 @@ class Field : public CJS_EmbedObj {
CPDF_FormControl* pFormControl);
static std::vector<CPDF_FormField*> GetFormFields(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& csFieldName);
+ const WideString& csFieldName);
static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CJS_DelayData* pData);
- bool AttachField(Document* pDocument, const CFX_WideString& csFieldName);
+ bool AttachField(Document* pDocument, const WideString& csFieldName);
void SetDelay(bool bDelay);
protected:
@@ -481,26 +439,26 @@ class Field : public CJS_EmbedObj {
std::wstring& strFieldName,
int& iControlNo);
std::vector<CPDF_FormField*> GetFormFields(
- const CFX_WideString& csFieldName) const;
+ const WideString& csFieldName) const;
CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
- bool ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
+ bool ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel);
void AddDelay_Int(FIELD_PROP prop, int32_t n);
void AddDelay_Bool(FIELD_PROP prop, bool b);
- void AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string);
- void AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string);
+ void AddDelay_String(FIELD_PROP prop, const ByteString& string);
+ void AddDelay_WideString(FIELD_PROP prop, const WideString& string);
void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect);
void AddDelay_Color(FIELD_PROP prop, const CFX_Color& color);
void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array);
void AddDelay_WideStringArray(FIELD_PROP prop,
- const std::vector<CFX_WideString>& array);
+ const std::vector<WideString>& array);
void DoDelay();
public:
Document* m_pJSDoc;
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
- CFX_WideString m_FieldName;
+ WideString m_FieldName;
int m_nFormControlIndex;
bool m_bCanSet;
bool m_bDelay;
diff --git a/fpdfsdk/javascript/Icon.cpp b/fpdfsdk/javascript/Icon.cpp
index fa2f92f3c9..47781dd83a 100644
--- a/fpdfsdk/javascript/Icon.cpp
+++ b/fpdfsdk/javascript/Icon.cpp
@@ -25,9 +25,7 @@ Icon::Icon(CJS_Object* pJSObject)
Icon::~Icon() {}
-bool Icon::name(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Icon::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
diff --git a/fpdfsdk/javascript/Icon.h b/fpdfsdk/javascript/Icon.h
index 5580678fd5..e856ee9e51 100644
--- a/fpdfsdk/javascript/Icon.h
+++ b/fpdfsdk/javascript/Icon.h
@@ -16,12 +16,12 @@ class Icon : public CJS_EmbedObj {
explicit Icon(CJS_Object* pJSObject);
~Icon() override;
- bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- CFX_WideString GetIconName() const { return m_swIconName; }
- void SetIconName(CFX_WideString name) { m_swIconName = name; }
+ bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ WideString GetIconName() const { return m_swIconName; }
+ void SetIconName(WideString name) { m_swIconName = name; }
private:
- CFX_WideString m_swIconName;
+ WideString m_swIconName;
};
class CJS_Icon : public CJS_Object {
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index f360e8f6b9..470a8fe40c 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -34,7 +34,7 @@ struct JSMethodSpec {
v8::FunctionCallback pMethodCall;
};
-template <class C, bool (C::*M)(CJS_Runtime*, CJS_PropValue&, CFX_WideString&)>
+template <class C, bool (C::*M)(CJS_Runtime*, CJS_PropValue&, WideString&)>
void JSPropGetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -48,7 +48,7 @@ void JSPropGetter(const char* prop_name_string,
if (!pJSObj)
return;
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
- CFX_WideString sError;
+ WideString sError;
CJS_PropValue value(pRuntime);
value.StartGetting();
if (!(pObj->*M)(pRuntime, value, sError)) {
@@ -59,7 +59,7 @@ void JSPropGetter(const char* prop_name_string,
info.GetReturnValue().Set(value.GetJSValue()->ToV8Value(pRuntime));
}
-template <class C, bool (C::*M)(CJS_Runtime*, CJS_PropValue&, CFX_WideString&)>
+template <class C, bool (C::*M)(CJS_Runtime*, CJS_PropValue&, WideString&)>
void JSPropSetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -74,7 +74,7 @@ void JSPropSetter(const char* prop_name_string,
if (!pJSObj)
return;
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
- CFX_WideString sError;
+ WideString sError;
CJS_PropValue propValue(pRuntime, CJS_Value(pRuntime, value));
propValue.StartSetting();
if (!(pObj->*M)(pRuntime, propValue, sError)) {
@@ -101,7 +101,7 @@ template <class C,
bool (C::*M)(CJS_Runtime*,
const std::vector<CJS_Value>&,
CJS_Value&,
- CFX_WideString&)>
+ WideString&)>
void JSMethod(const char* method_name_string,
const char* class_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -118,7 +118,7 @@ void JSMethod(const char* method_name_string,
if (!pJSObj)
return;
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
- CFX_WideString sError;
+ WideString sError;
CJS_Value valueRes(pRuntime);
if (!(pObj->*M)(pRuntime, parameters, valueRes, sError)) {
pRuntime->Error(
@@ -325,8 +325,8 @@ void JSSpecialPropQuery(const char*,
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(
- CFX_ByteStringC(*utf8_value, utf8_value.length()));
+ WideString propname =
+ WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
bool bRet = pObj->QueryProperty(propname.c_str());
info.GetReturnValue().Set(bRet ? 4 : 0);
}
@@ -347,9 +347,9 @@ void JSSpecialPropGet(const char* class_name,
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(
- CFX_ByteStringC(*utf8_value, utf8_value.length()));
- CFX_WideString sError;
+ WideString propname =
+ WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
+ WideString sError;
CJS_PropValue value(pRuntime);
value.StartGetting();
if (!pObj->DoProperty(pRuntime, propname.c_str(), value, sError)) {
@@ -376,9 +376,9 @@ void JSSpecialPropPut(const char* class_name,
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(
- CFX_ByteStringC(*utf8_value, utf8_value.length()));
- CFX_WideString sError;
+ WideString propname =
+ WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
+ WideString sError;
CJS_PropValue PropValue(pRuntime, CJS_Value(pRuntime, value));
PropValue.StartSetting();
if (!pObj->DoProperty(pRuntime, propname.c_str(), PropValue, sError)) {
@@ -402,20 +402,18 @@ void JSSpecialPropDel(const char* class_name,
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(
- CFX_ByteStringC(*utf8_value, utf8_value.length()));
- CFX_WideString sError;
+ WideString propname =
+ WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length()));
+ WideString sError;
if (!pObj->DelProperty(pRuntime, propname.c_str(), sError)) {
- CFX_ByteString cbName;
+ ByteString cbName;
cbName.Format("%s.%s", class_name, "DelProperty");
// Probably a missing call to JSFX_Error().
}
}
-template <bool (*F)(CJS_Runtime*,
- const std::vector<CJS_Value>&,
- CJS_Value&,
- CFX_WideString&)>
+template <bool (
+ *F)(CJS_Runtime*, const std::vector<CJS_Value>&, CJS_Value&, WideString&)>
void JSGlobalFunc(const char* func_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
CJS_Runtime* pRuntime =
@@ -427,7 +425,7 @@ void JSGlobalFunc(const char* func_name_string,
parameters.push_back(CJS_Value(pRuntime, info[i]));
}
CJS_Value valueRes(pRuntime);
- CFX_WideString sError;
+ WideString sError;
if (!(*F)(pRuntime, parameters, valueRes, sError)) {
pRuntime->Error(JSFormatErrorString(func_name_string, nullptr, sError));
return;
diff --git a/fpdfsdk/javascript/JS_EventHandler.cpp b/fpdfsdk/javascript/JS_EventHandler.cpp
index a63b7a82fe..670d43ef7c 100644
--- a/fpdfsdk/javascript/JS_EventHandler.cpp
+++ b/fpdfsdk/javascript/JS_EventHandler.cpp
@@ -43,7 +43,7 @@ void CJS_EventHandler::OnApp_Init() {
}
void CJS_EventHandler::OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) {
+ const WideString& strTargetName) {
Initial(JET_DOC_OPEN);
m_pTargetFormFillEnv.Reset(pFormFillEnv);
m_strTargetName = strTargetName;
@@ -146,36 +146,36 @@ void CJS_EventHandler::OnField_MouseUp(bool bModifier,
void CJS_EventHandler::OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) {
+ const WideString& Value) {
Initial(JET_FIELD_FOCUS);
m_bModifier = bModifier;
m_bShift = bShift;
m_strTargetName = pTarget->GetFullName();
- m_pValue = (CFX_WideString*)&Value;
+ m_pValue = (WideString*)&Value;
}
void CJS_EventHandler::OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) {
+ const WideString& Value) {
Initial(JET_FIELD_BLUR);
m_bModifier = bModifier;
m_bShift = bShift;
m_strTargetName = pTarget->GetFullName();
- m_pValue = (CFX_WideString*)&Value;
+ m_pValue = (WideString*)&Value;
}
-void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+void CJS_EventHandler::OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool KeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) {
@@ -196,13 +196,13 @@ void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange,
m_bFieldFull = bFieldFull;
}
-void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+void CJS_EventHandler::OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) {
Initial(JET_FIELD_VALIDATE);
@@ -218,7 +218,7 @@ void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange,
void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) {
Initial(JET_FIELD_CALCULATE);
@@ -230,7 +230,7 @@ void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource,
}
void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) {
Initial(JET_FIELD_FORMAT);
@@ -351,7 +351,7 @@ void CJS_EventHandler::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) {
void CJS_EventHandler::OnMenu_Exec(
CPDFSDK_FormFillEnvironment* pTargetFormFillEnv,
- const CFX_WideString& strTargetName) {
+ const WideString& strTargetName) {
Initial(JET_MENU_EXEC);
m_pTargetFormFillEnv.Reset(pTargetFormFillEnv);
m_strTargetName = strTargetName;
@@ -408,14 +408,14 @@ bool CJS_EventHandler::IsValid() {
return m_bValid;
}
-CFX_WideString& CJS_EventHandler::Change() {
+WideString& CJS_EventHandler::Change() {
if (m_pWideStrChange) {
return *m_pWideStrChange;
}
return m_WideStrChangeDu;
}
-CFX_WideString CJS_EventHandler::ChangeEx() {
+WideString CJS_EventHandler::ChangeEx() {
return m_WideStrChangeEx;
}
@@ -640,7 +640,7 @@ Field* CJS_EventHandler::Target_Field() {
return pField;
}
-CFX_WideString& CJS_EventHandler::Value() {
+WideString& CJS_EventHandler::Value() {
return *m_pValue;
}
@@ -648,6 +648,6 @@ bool CJS_EventHandler::WillCommit() {
return m_bWillCommit;
}
-CFX_WideString CJS_EventHandler::TargetName() {
+WideString CJS_EventHandler::TargetName() {
return m_strTargetName;
}
diff --git a/fpdfsdk/javascript/JS_EventHandler.h b/fpdfsdk/javascript/JS_EventHandler.h
index 82d9d6a93b..8273b41cc5 100644
--- a/fpdfsdk/javascript/JS_EventHandler.h
+++ b/fpdfsdk/javascript/JS_EventHandler.h
@@ -67,7 +67,7 @@ class CJS_EventHandler {
void OnApp_Init();
void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName);
+ const WideString& strTargetName);
void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv);
@@ -81,30 +81,30 @@ class CJS_EventHandler {
void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc);
void OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit);
- void OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool KeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc);
- void OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc);
void OnField_MouseDown(bool bModifier, bool bShift, CPDF_FormField* pTarget);
@@ -114,11 +114,11 @@ class CJS_EventHandler {
void OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value);
+ const WideString& Value);
void OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value);
+ const WideString& Value);
void OnScreen_Focus(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
void OnScreen_Blur(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
@@ -135,7 +135,7 @@ class CJS_EventHandler {
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName);
+ const WideString& strTargetName);
void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void OnConsole_Exec();
void OnExternal_Exec();
@@ -145,8 +145,8 @@ class CJS_EventHandler {
void Destroy();
bool IsValid();
- CFX_WideString& Change();
- CFX_WideString ChangeEx();
+ WideString& Change();
+ WideString ChangeEx();
int CommitKey();
bool FieldFull();
bool KeyDown();
@@ -159,9 +159,9 @@ class CJS_EventHandler {
bool Shift();
Field* Source();
Field* Target_Field();
- CFX_WideString& Value();
+ WideString& Value();
bool WillCommit();
- CFX_WideString TargetName();
+ WideString TargetName();
JS_EVENT_T EventType() { return m_eEventType; }
@@ -170,11 +170,11 @@ class CJS_EventHandler {
JS_EVENT_T m_eEventType;
bool m_bValid;
- CFX_WideString m_strTargetName;
- CFX_WideString m_strSourceName;
- CFX_UnownedPtr<CFX_WideString> m_pWideStrChange;
- CFX_WideString m_WideStrChangeDu;
- CFX_WideString m_WideStrChangeEx;
+ WideString m_strTargetName;
+ WideString m_strSourceName;
+ CFX_UnownedPtr<WideString> m_pWideStrChange;
+ WideString m_WideStrChangeDu;
+ WideString m_WideStrChangeEx;
int m_nCommitKey;
bool m_bKeyDown;
bool m_bModifier;
@@ -184,7 +184,7 @@ class CJS_EventHandler {
int* m_pISelStart;
int m_nSelStartDu;
bool m_bWillCommit;
- CFX_UnownedPtr<CFX_WideString> m_pValue;
+ CFX_UnownedPtr<WideString> m_pValue;
bool m_bFieldFull;
bool* m_pbRc;
bool m_bRcDu;
diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp
index 14202646c5..ce3ce68fb3 100644
--- a/fpdfsdk/javascript/JS_GlobalData.cpp
+++ b/fpdfsdk/javascript/JS_GlobalData.cpp
@@ -32,7 +32,7 @@ const uint8_t JS_RC4KEY[] = {
0xf8, 0x77, 0xd5, 0xa3};
// Returns true if non-empty, setting sPropName
-bool TrimPropName(CFX_ByteString* sPropName) {
+bool TrimPropName(ByteString* sPropName) {
sPropName->TrimLeft();
sPropName->TrimRight();
return sPropName->GetLength() != 0;
@@ -69,7 +69,7 @@ CJS_GlobalData::~CJS_GlobalData() {
}
CJS_GlobalData::iterator CJS_GlobalData::FindGlobalVariable(
- const CFX_ByteString& propname) {
+ const ByteString& propname) {
for (auto it = m_arrayGlobalData.begin(); it != m_arrayGlobalData.end();
++it) {
if ((*it)->data.sKey == propname)
@@ -79,7 +79,7 @@ CJS_GlobalData::iterator CJS_GlobalData::FindGlobalVariable(
}
CJS_GlobalData::const_iterator CJS_GlobalData::FindGlobalVariable(
- const CFX_ByteString& propname) const {
+ const ByteString& propname) const {
for (auto it = m_arrayGlobalData.begin(); it != m_arrayGlobalData.end();
++it) {
if ((*it)->data.sKey == propname)
@@ -89,14 +89,14 @@ CJS_GlobalData::const_iterator CJS_GlobalData::FindGlobalVariable(
}
CJS_GlobalData_Element* CJS_GlobalData::GetGlobalVariable(
- const CFX_ByteString& propname) {
+ const ByteString& propname) {
auto iter = FindGlobalVariable(propname);
return iter != m_arrayGlobalData.end() ? iter->get() : nullptr;
}
-void CJS_GlobalData::SetGlobalVariableNumber(const CFX_ByteString& propname,
+void CJS_GlobalData::SetGlobalVariableNumber(const ByteString& propname,
double dData) {
- CFX_ByteString sPropName(propname);
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -112,9 +112,9 @@ void CJS_GlobalData::SetGlobalVariableNumber(const CFX_ByteString& propname,
m_arrayGlobalData.push_back(std::move(pNewData));
}
-void CJS_GlobalData::SetGlobalVariableBoolean(const CFX_ByteString& propname,
+void CJS_GlobalData::SetGlobalVariableBoolean(const ByteString& propname,
bool bData) {
- CFX_ByteString sPropName(propname);
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -130,9 +130,9 @@ void CJS_GlobalData::SetGlobalVariableBoolean(const CFX_ByteString& propname,
m_arrayGlobalData.push_back(std::move(pNewData));
}
-void CJS_GlobalData::SetGlobalVariableString(const CFX_ByteString& propname,
- const CFX_ByteString& sData) {
- CFX_ByteString sPropName(propname);
+void CJS_GlobalData::SetGlobalVariableString(const ByteString& propname,
+ const ByteString& sData) {
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -149,9 +149,9 @@ void CJS_GlobalData::SetGlobalVariableString(const CFX_ByteString& propname,
}
void CJS_GlobalData::SetGlobalVariableObject(
- const CFX_ByteString& propname,
+ const ByteString& propname,
const CJS_GlobalVariableArray& array) {
- CFX_ByteString sPropName(propname);
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -167,8 +167,8 @@ void CJS_GlobalData::SetGlobalVariableObject(
m_arrayGlobalData.push_back(std::move(pNewData));
}
-void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) {
- CFX_ByteString sPropName(propname);
+void CJS_GlobalData::SetGlobalVariableNull(const ByteString& propname) {
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return;
@@ -182,9 +182,9 @@ void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) {
m_arrayGlobalData.push_back(std::move(pNewData));
}
-bool CJS_GlobalData::SetGlobalVariablePersistent(const CFX_ByteString& propname,
+bool CJS_GlobalData::SetGlobalVariablePersistent(const ByteString& propname,
bool bPersistent) {
- CFX_ByteString sPropName(propname);
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return false;
@@ -196,8 +196,8 @@ bool CJS_GlobalData::SetGlobalVariablePersistent(const CFX_ByteString& propname,
return true;
}
-bool CJS_GlobalData::DeleteGlobalVariable(const CFX_ByteString& propname) {
- CFX_ByteString sPropName(propname);
+bool CJS_GlobalData::DeleteGlobalVariable(const ByteString& propname) {
+ ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
return false;
@@ -254,7 +254,7 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() {
if (p + dwNameLen > pBuffer + nLength)
break;
- CFX_ByteString sEntry = CFX_ByteString(p, dwNameLen);
+ ByteString sEntry = ByteString(p, dwNameLen);
p += sizeof(char) * dwNameLen;
JS_GlobalDataType wDataType =
@@ -291,7 +291,7 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() {
if (p + dwLength > pBuffer + nLength)
break;
- SetGlobalVariableString(sEntry, CFX_ByteString(p, dwLength));
+ SetGlobalVariableString(sEntry, ByteString(p, dwLength));
SetGlobalVariablePersistent(sEntry, true);
p += sizeof(char) * dwLength;
} break;
@@ -353,7 +353,7 @@ void CJS_GlobalData::WriteFileBuffer(const wchar_t* sFilePath,
// UnSupport.
}
-void CJS_GlobalData::MakeByteString(const CFX_ByteString& name,
+void CJS_GlobalData::MakeByteString(const ByteString& name,
CJS_KeyValue* pData,
CFX_BinaryBuf& sData) {
switch (pData->nType) {
diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h
index 24e68c2ba6..249bca6a74 100644
--- a/fpdfsdk/javascript/JS_GlobalData.h
+++ b/fpdfsdk/javascript/JS_GlobalData.h
@@ -29,16 +29,16 @@ class CJS_GlobalData {
static CJS_GlobalData* GetRetainedInstance(CPDFSDK_FormFillEnvironment* pApp);
void Release();
- void SetGlobalVariableNumber(const CFX_ByteString& propname, double dData);
- void SetGlobalVariableBoolean(const CFX_ByteString& propname, bool bData);
- void SetGlobalVariableString(const CFX_ByteString& propname,
- const CFX_ByteString& sData);
- void SetGlobalVariableObject(const CFX_ByteString& propname,
+ void SetGlobalVariableNumber(const ByteString& propname, double dData);
+ void SetGlobalVariableBoolean(const ByteString& propname, bool bData);
+ void SetGlobalVariableString(const ByteString& propname,
+ const ByteString& sData);
+ void SetGlobalVariableObject(const ByteString& propname,
const CJS_GlobalVariableArray& array);
- void SetGlobalVariableNull(const CFX_ByteString& propname);
- bool SetGlobalVariablePersistent(const CFX_ByteString& propname,
+ void SetGlobalVariableNull(const ByteString& propname);
+ bool SetGlobalVariablePersistent(const ByteString& propname,
bool bPersistent);
- bool DeleteGlobalVariable(const CFX_ByteString& propname);
+ bool DeleteGlobalVariable(const ByteString& propname);
int32_t GetSize() const;
CJS_GlobalData_Element* GetAt(int index) const;
@@ -55,9 +55,9 @@ class CJS_GlobalData {
void LoadGlobalPersistentVariables();
void SaveGlobalPersisitentVariables();
- CJS_GlobalData_Element* GetGlobalVariable(const CFX_ByteString& sPropname);
- iterator FindGlobalVariable(const CFX_ByteString& sPropname);
- const_iterator FindGlobalVariable(const CFX_ByteString& sPropname) const;
+ CJS_GlobalData_Element* GetGlobalVariable(const ByteString& sPropname);
+ iterator FindGlobalVariable(const ByteString& sPropname);
+ const_iterator FindGlobalVariable(const ByteString& sPropname) const;
void LoadFileBuffer(const wchar_t* sFilePath,
uint8_t*& pBuffer,
@@ -65,13 +65,13 @@ class CJS_GlobalData {
void WriteFileBuffer(const wchar_t* sFilePath,
const char* pBuffer,
int32_t nLength);
- void MakeByteString(const CFX_ByteString& name,
+ void MakeByteString(const ByteString& name,
CJS_KeyValue* pData,
CFX_BinaryBuf& sData);
size_t m_RefCount;
std::vector<std::unique_ptr<CJS_GlobalData_Element>> m_arrayGlobalData;
- CFX_WideString m_sFilePath;
+ WideString m_sFilePath;
};
#endif // FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_
diff --git a/fpdfsdk/javascript/JS_KeyValue.h b/fpdfsdk/javascript/JS_KeyValue.h
index 9fc71802ef..63669358a4 100644
--- a/fpdfsdk/javascript/JS_KeyValue.h
+++ b/fpdfsdk/javascript/JS_KeyValue.h
@@ -35,11 +35,11 @@ class CJS_KeyValue {
CJS_KeyValue();
~CJS_KeyValue();
- CFX_ByteString sKey;
+ ByteString sKey;
JS_GlobalDataType nType;
double dData;
bool bData;
- CFX_ByteString sData;
+ ByteString sData;
CJS_GlobalVariableArray objData;
};
diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
index 73a38fcfa6..068031f450 100644
--- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp
+++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
@@ -17,13 +17,13 @@ class CJS_EventContextStub final : public IJS_EventContext {
~CJS_EventContextStub() override {}
// IJS_EventContext:
- bool RunScript(const CFX_WideString& script, CFX_WideString* info) override {
+ bool RunScript(const WideString& script, WideString* info) override {
return false;
}
void OnApp_Init() override {}
void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) override {}
+ const WideString& strTargetName) override {}
void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
@@ -48,37 +48,37 @@ class CJS_EventContextStub final : public IJS_EventContext {
void OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) override {}
+ const WideString& Value) override {}
void OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) override {}
+ const WideString& Value) override {}
void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) override {}
void OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) override {}
- void OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool KeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) override {}
- void OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) override {}
void OnScreen_Focus(bool bModifier,
bool bShift,
@@ -113,7 +113,7 @@ class CJS_EventContextStub final : public IJS_EventContext {
void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override {}
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString&) override {}
+ const WideString&) override {}
void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnConsole_Exec() override {}
void OnExternal_Exec() override {}
@@ -138,17 +138,16 @@ class CJS_RuntimeStub final : public IJS_Runtime {
}
#ifdef PDF_ENABLE_XFA
- bool GetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override {
+ bool GetValueByName(const ByteStringView&, CFXJSE_Value*) override {
return false;
}
- bool SetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override {
+ bool SetValueByName(const ByteStringView&, CFXJSE_Value*) override {
return false;
}
#endif // PDF_ENABLE_XFA
- int ExecuteScript(const CFX_WideString& script,
- CFX_WideString* info) override {
+ int ExecuteScript(const WideString& script, WideString* info) override {
return 0;
}
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index e52d7d1a0f..1a27d22270 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -200,7 +200,7 @@ CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const wchar_t* pWstr)
: m_pValue(pRuntime->NewString(pWstr)) {}
CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const char* pStr)
- : m_pValue(pRuntime->NewString(CFX_WideString::FromLocal(pStr).c_str())) {}
+ : m_pValue(pRuntime->NewString(WideString::FromLocal(pStr).c_str())) {}
CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const CJS_Array& array)
: m_pValue(array.ToV8Array(pRuntime)) {}
@@ -245,12 +245,12 @@ v8::Local<v8::Object> CJS_Value::ToV8Object(CJS_Runtime* pRuntime) const {
return pRuntime->ToObject(m_pValue);
}
-CFX_WideString CJS_Value::ToCFXWideString(CJS_Runtime* pRuntime) const {
+WideString CJS_Value::ToCFXWideString(CJS_Runtime* pRuntime) const {
return pRuntime->ToWideString(m_pValue);
}
-CFX_ByteString CJS_Value::ToCFXByteString(CJS_Runtime* pRuntime) const {
- return CFX_ByteString::FromUnicode(ToCFXWideString(pRuntime));
+ByteString CJS_Value::ToCFXByteString(CJS_Runtime* pRuntime) const {
+ return ByteString::FromUnicode(ToCFXWideString(pRuntime));
}
v8::Local<v8::Value> CJS_Value::ToV8Value(CJS_Runtime* pRuntime) const {
@@ -268,7 +268,7 @@ void CJS_Value::SetNull(CJS_Runtime* pRuntime) {
void CJS_Value::MaybeCoerceToNumber(CJS_Runtime* pRuntime) {
bool bAllowNaN = false;
if (GetType() == VT_string) {
- CFX_ByteString bstr = ToCFXByteString(pRuntime);
+ ByteString bstr = ToCFXByteString(pRuntime);
if (bstr.GetLength() == 0)
return;
if (bstr == "NaN")
@@ -398,12 +398,12 @@ void CJS_PropValue::operator>>(v8::Local<v8::Object>& ppObj) const {
ppObj = m_Value.ToV8Object(m_pJSRuntime.Get());
}
-void CJS_PropValue::operator<<(CFX_ByteString str) {
+void CJS_PropValue::operator<<(ByteString str) {
ASSERT(!m_bIsSetting);
m_Value = CJS_Value(m_pJSRuntime.Get(), str.c_str());
}
-void CJS_PropValue::operator>>(CFX_ByteString& str) const {
+void CJS_PropValue::operator>>(ByteString& str) const {
ASSERT(m_bIsSetting);
str = m_Value.ToCFXByteString(m_pJSRuntime.Get());
}
@@ -413,12 +413,12 @@ void CJS_PropValue::operator<<(const wchar_t* str) {
m_Value = CJS_Value(m_pJSRuntime.Get(), str);
}
-void CJS_PropValue::operator>>(CFX_WideString& wide_string) const {
+void CJS_PropValue::operator>>(WideString& wide_string) const {
ASSERT(m_bIsSetting);
wide_string = m_Value.ToCFXWideString(m_pJSRuntime.Get());
}
-void CJS_PropValue::operator<<(CFX_WideString wide_string) {
+void CJS_PropValue::operator<<(WideString wide_string) {
ASSERT(!m_bIsSetting);
m_Value = CJS_Value(m_pJSRuntime.Get(), wide_string.c_str());
}
@@ -588,9 +588,8 @@ double CJS_Date::ToDouble(CJS_Runtime* pRuntime) const {
return !m_pDate.IsEmpty() ? pRuntime->ToDouble(m_pDate) : 0.0;
}
-CFX_WideString CJS_Date::ToString(CJS_Runtime* pRuntime) const {
- return !m_pDate.IsEmpty() ? pRuntime->ToWideString(m_pDate)
- : CFX_WideString();
+WideString CJS_Date::ToString(CJS_Runtime* pRuntime) const {
+ return !m_pDate.IsEmpty() ? pRuntime->ToWideString(m_pDate) : WideString();
}
v8::Local<v8::Date> CJS_Date::ToV8Date(CJS_Runtime* pRuntime) const {
@@ -634,7 +633,7 @@ int JS_GetSecFromTime(double dt) {
return (int)Mod(floor(dt / 1000), 60);
}
-double JS_DateParse(const CFX_WideString& str) {
+double JS_DateParse(const WideString& str) {
v8::Isolate* pIsolate = v8::Isolate::GetCurrent();
v8::Isolate::Scope isolate_scope(pIsolate);
v8::HandleScope scope(pIsolate);
@@ -659,7 +658,7 @@ double JS_DateParse(const CFX_WideString& str) {
const int argc = 1;
v8::Local<v8::Value> timeStr =
CJS_Runtime::CurrentRuntimeFromIsolate(pIsolate)->NewString(
- str.AsStringC());
+ str.AsStringView());
v8::Local<v8::Value> argv[argc] = {timeStr};
v = funC->Call(context, context->Global(), argc, argv).ToLocalChecked();
if (v->IsNumber()) {
diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h
index 2c0be3592c..1d430ee06c 100644
--- a/fpdfsdk/javascript/JS_Value.h
+++ b/fpdfsdk/javascript/JS_Value.h
@@ -59,8 +59,8 @@ class CJS_Value {
double ToDouble(CJS_Runtime* pRuntime) const;
float ToFloat(CJS_Runtime* pRuntime) const;
CJS_Object* ToCJSObject(CJS_Runtime* pRuntime) const;
- CFX_WideString ToCFXWideString(CJS_Runtime* pRuntime) const;
- CFX_ByteString ToCFXByteString(CJS_Runtime* pRuntime) const;
+ WideString ToCFXWideString(CJS_Runtime* pRuntime) const;
+ ByteString ToCFXByteString(CJS_Runtime* pRuntime) const;
v8::Local<v8::Object> ToV8Object(CJS_Runtime* pRuntime) const;
v8::Local<v8::Array> ToV8Array(CJS_Runtime* pRuntime) const;
v8::Local<v8::Value> ToV8Value(CJS_Runtime* pRuntime) const;
@@ -102,10 +102,10 @@ class CJS_PropValue {
void operator>>(CJS_Object*& ppObj) const;
void operator<<(CJS_Document* pJsDoc);
void operator>>(CJS_Document*& ppJsDoc) const;
- void operator<<(CFX_ByteString);
- void operator>>(CFX_ByteString&) const;
- void operator<<(CFX_WideString);
- void operator>>(CFX_WideString&) const;
+ void operator<<(ByteString);
+ void operator>>(ByteString&) const;
+ void operator<<(WideString);
+ void operator>>(WideString&) const;
void operator<<(const wchar_t* c_string);
void operator<<(v8::Local<v8::Object>);
void operator>>(v8::Local<v8::Object>&) const;
@@ -179,7 +179,7 @@ class CJS_Date {
v8::Local<v8::Date> ToV8Date(CJS_Runtime* pRuntime) const;
double ToDouble(CJS_Runtime* pRuntime) const;
- CFX_WideString ToString(CJS_Runtime* pRuntime) const;
+ WideString ToString(CJS_Runtime* pRuntime) const;
protected:
v8::Local<v8::Date> m_pDate;
@@ -192,7 +192,7 @@ int JS_GetDayFromTime(double dt);
int JS_GetHourFromTime(double dt);
int JS_GetMinFromTime(double dt);
int JS_GetSecFromTime(double dt);
-double JS_DateParse(const CFX_WideString& str);
+double JS_DateParse(const WideString& str);
double JS_MakeDay(int nYear, int nMonth, int nDay);
double JS_MakeTime(int nHour, int nMin, int nSec, int nMs);
double JS_MakeDate(double day, double time);
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index 970bbd2c75..ba42c3ecbc 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -70,15 +70,15 @@ const wchar_t* const fullmonths[] = {L"January", L"February", L"March",
L"July", L"August", L"September",
L"October", L"November", L"December"};
-CFX_ByteString StrTrim(const CFX_ByteString& pStr) {
- CFX_ByteString result(pStr);
+ByteString StrTrim(const ByteString& pStr) {
+ ByteString result(pStr);
result.TrimLeft(' ');
result.TrimRight(' ');
return result;
}
-CFX_WideString StrTrim(const CFX_WideString& pStr) {
- CFX_WideString result(pStr);
+WideString StrTrim(const WideString& pStr) {
+ WideString result(pStr);
result.TrimLeft(' ');
result.TrimRight(' ');
return result;
@@ -91,10 +91,10 @@ void AlertIfPossible(CJS_EventContext* pContext, const wchar_t* swMsg) {
}
#if _FX_OS_ != _FX_ANDROID_
-CFX_ByteString CalculateString(double dValue,
- int iDec,
- int* iDec2,
- bool* bNegative) {
+ByteString CalculateString(double dValue,
+ int iDec,
+ int* iDec2,
+ bool* bNegative) {
*bNegative = dValue < 0;
if (*bNegative)
dValue = -dValue;
@@ -109,14 +109,14 @@ CFX_ByteString CalculateString(double dValue,
size_t iDecimalPos = stringValue.find(".");
*iDec2 = iDecimalPos == std::string::npos ? stringValue.size()
: static_cast<int>(iDecimalPos);
- return CFX_ByteString(stringValue.c_str());
+ return ByteString(stringValue.c_str());
}
#endif
} // namespace
-bool CJS_PublicMethods::IsNumber(const CFX_WideString& str) {
- CFX_WideString sTrim = StrTrim(str);
+bool CJS_PublicMethods::IsNumber(const WideString& str) {
+ WideString sTrim = StrTrim(str);
const wchar_t* pTrim = sTrim.c_str();
const wchar_t* p = pTrim;
bool bDot = false;
@@ -194,8 +194,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime,
val.ConvertToArray(pRuntime, StrArray);
return StrArray;
}
- CFX_WideString wsStr = val.ToCFXWideString(pRuntime);
- CFX_ByteString t = CFX_ByteString::FromUnicode(wsStr);
+ WideString wsStr = val.ToCFXWideString(pRuntime);
+ ByteString t = ByteString::FromUnicode(wsStr);
const char* p = t.c_str();
int ch = ',';
@@ -204,9 +204,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime,
while (*p) {
const char* pTemp = strchr(p, ch);
if (!pTemp) {
- StrArray.SetElement(
- pRuntime, nIndex,
- CJS_Value(pRuntime, StrTrim(CFX_ByteString(p)).c_str()));
+ StrArray.SetElement(pRuntime, nIndex,
+ CJS_Value(pRuntime, StrTrim(ByteString(p)).c_str()));
break;
}
@@ -214,9 +213,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime,
strncpy(pSub, p, pTemp - p);
*(pSub + (pTemp - p)) = '\0';
- StrArray.SetElement(
- pRuntime, nIndex,
- CJS_Value(pRuntime, StrTrim(CFX_ByteString(pSub)).c_str()));
+ StrArray.SetElement(pRuntime, nIndex,
+ CJS_Value(pRuntime, StrTrim(ByteString(pSub)).c_str()));
delete[] pSub;
nIndex++;
@@ -225,7 +223,7 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime,
return StrArray;
}
-int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& str,
+int CJS_PublicMethods::ParseStringInteger(const WideString& str,
FX_STRSIZE nStart,
FX_STRSIZE& nSkip,
FX_STRSIZE nMaxStep) {
@@ -248,10 +246,10 @@ int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& str,
return nRet;
}
-CFX_WideString CJS_PublicMethods::ParseStringString(const CFX_WideString& str,
- FX_STRSIZE nStart,
- FX_STRSIZE& nSkip) {
- CFX_WideString swRet;
+WideString CJS_PublicMethods::ParseStringString(const WideString& str,
+ FX_STRSIZE nStart,
+ FX_STRSIZE& nSkip) {
+ WideString swRet;
nSkip = 0;
for (FX_STRSIZE i = nStart, sz = str.GetLength(); i < sz; i++) {
wchar_t c = str[i];
@@ -265,7 +263,7 @@ CFX_WideString CJS_PublicMethods::ParseStringString(const CFX_WideString& str,
return swRet;
}
-double CJS_PublicMethods::ParseNormalDate(const CFX_WideString& value,
+double CJS_PublicMethods::ParseNormalDate(const WideString& value,
bool* bWrongFormat) {
double dt = JS_GetDateTime();
@@ -340,13 +338,13 @@ double CJS_PublicMethods::ParseNormalDate(const CFX_WideString& value,
return dt;
}
- CFX_WideString swTemp;
+ WideString swTemp;
swTemp.Format(L"%d/%d/%d %d:%d:%d", nMonth, nDay, nYear, nHour, nMin, nSec);
return JS_DateParse(swTemp);
}
-double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
- const CFX_WideString& format,
+double CJS_PublicMethods::MakeRegularDate(const WideString& value,
+ const WideString& format,
bool* bWrongFormat) {
double dt = JS_GetDateTime();
@@ -485,7 +483,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
} else if (remaining == 2 || format[i + 3] != c) {
switch (c) {
case 'm': {
- CFX_WideString sMonth = ParseStringString(value, j, nSkip);
+ WideString sMonth = ParseStringString(value, j, nSkip);
bool bFind = false;
for (int m = 0; m < 12; m++) {
if (sMonth.CompareNoCase(months[m]) == 0) {
@@ -520,11 +518,11 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
case 'm': {
bool bFind = false;
- CFX_WideString sMonth = ParseStringString(value, j, nSkip);
+ WideString sMonth = ParseStringString(value, j, nSkip);
sMonth.MakeLower();
for (int m = 0; m < 12; m++) {
- CFX_WideString sFullMonths = fullmonths[m];
+ WideString sFullMonths = fullmonths[m];
sFullMonths.MakeLower();
if (sFullMonths.Contains(sMonth.c_str())) {
@@ -617,9 +615,9 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
return dRet;
}
-CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate,
- const CFX_WideString& format) {
- CFX_WideString sRet = L"", sPart = L"";
+WideString CJS_PublicMethods::MakeFormatDate(double dDate,
+ const WideString& format) {
+ WideString sRet = L"", sPart = L"";
int nYear = JS_GetYearFromTime(dDate);
int nMonth = JS_GetMonthFromTime(dDate) + 1;
@@ -753,7 +751,7 @@ CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate,
bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
#if _FX_OS_ != _FX_ANDROID_
if (params.size() != 6) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
@@ -765,8 +763,8 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- CFX_WideString& Value = pEvent->Value();
- CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value));
+ WideString& Value = pEvent->Value();
+ ByteString strValue = StrTrim(ByteString::FromUnicode(Value));
if (strValue.IsEmpty())
return true;
@@ -774,7 +772,7 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
int iSepStyle = params[1].ToInt(pRuntime);
int iNegStyle = params[2].ToInt(pRuntime);
// params[3] is iCurrStyle, it's not used.
- CFX_WideString wstrCurrency = params[4].ToCFXWideString(pRuntime);
+ WideString wstrCurrency = params[4].ToCFXWideString(pRuntime);
bool bCurrencyPrepend = params[5].ToBool(pRuntime);
if (iDec < 0)
@@ -825,7 +823,7 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
}
// Processing currency string
- Value = CFX_WideString::FromLocal(strValue.AsStringC());
+ Value = WideString::FromLocal(strValue.AsStringView());
if (bCurrencyPrepend)
Value = wstrCurrency + Value;
@@ -900,7 +898,7 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 2)
return false;
@@ -909,12 +907,12 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- CFX_WideString& val = pEvent->Value();
- CFX_WideString& wstrChange = pEvent->Change();
- CFX_WideString wstrValue = val;
+ WideString& val = pEvent->Value();
+ WideString& wstrChange = pEvent->Change();
+ WideString wstrValue = val;
if (pEvent->WillCommit()) {
- CFX_WideString swTemp = StrTrim(wstrValue);
+ WideString swTemp = StrTrim(wstrValue);
if (swTemp.IsEmpty())
return true;
@@ -927,7 +925,7 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
return true; // it happens after the last keystroke and before validating,
}
- CFX_WideString wstrSelected;
+ WideString wstrSelected;
if (pEvent->SelStart() != -1) {
wstrSelected = wstrValue.Mid(pEvent->SelStart(),
pEvent->SelEnd() - pEvent->SelStart());
@@ -981,8 +979,8 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
}
}
- CFX_WideString wprefix = wstrValue.Left(pEvent->SelStart());
- CFX_WideString wpostfix;
+ WideString wprefix = wstrValue.Left(pEvent->SelStart());
+ WideString wpostfix;
if (pEvent->SelEnd() >= 0 &&
static_cast<FX_STRSIZE>(pEvent->SelEnd()) < wstrValue.GetLength())
wpostfix = wstrValue.Right(wstrValue.GetLength() -
@@ -995,7 +993,7 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
#if _FX_OS_ != _FX_ANDROID_
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
@@ -1007,8 +1005,8 @@ bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- CFX_WideString& Value = pEvent->Value();
- CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value));
+ WideString& Value = pEvent->Value();
+ ByteString strValue = StrTrim(ByteString::FromUnicode(Value));
if (strValue.IsEmpty())
return true;
@@ -1078,7 +1076,7 @@ bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime,
if (iNegative)
strValue = "-" + strValue;
strValue += "%";
- Value = CFX_WideString::FromLocal(strValue.AsStringC());
+ Value = WideString::FromLocal(strValue.AsStringView());
#endif
return true;
}
@@ -1087,7 +1085,7 @@ bool CJS_PublicMethods::AFPercent_Keystroke(
CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return AFNumber_Keystroke(pRuntime, params, vRet, sError);
}
@@ -1095,7 +1093,7 @@ bool CJS_PublicMethods::AFPercent_Keystroke(
bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1106,12 +1104,12 @@ bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- CFX_WideString& val = pEvent->Value();
- CFX_WideString strValue = val;
+ WideString& val = pEvent->Value();
+ WideString strValue = val;
if (strValue.IsEmpty())
return true;
- CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
+ WideString sFormat = params[0].ToCFXWideString(pRuntime);
double dDate = 0.0f;
if (strValue.Contains(L"GMT")) {
@@ -1123,7 +1121,7 @@ bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime,
}
if (std::isnan(dDate)) {
- CFX_WideString swMsg;
+ WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pContext, swMsg.c_str());
@@ -1134,9 +1132,9 @@ bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime,
return true;
}
-double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
- std::vector<CFX_WideString> wsArray;
- CFX_WideString sTemp = L"";
+double CJS_PublicMethods::MakeInterDate(const WideString& strValue) {
+ std::vector<WideString> wsArray;
+ WideString sTemp = L"";
for (const auto& c : strValue) {
if (c == L' ' || c == L':') {
wsArray.push_back(sTemp);
@@ -1176,11 +1174,11 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
else if (sTemp.Compare(L"Dec") == 0)
nMonth = 12;
- int nDay = FX_atof(wsArray[2].AsStringC());
- int nHour = FX_atof(wsArray[3].AsStringC());
- int nMin = FX_atof(wsArray[4].AsStringC());
- int nSec = FX_atof(wsArray[5].AsStringC());
- int nYear = FX_atof(wsArray[7].AsStringC());
+ int nDay = FX_atof(wsArray[2].AsStringView());
+ int nHour = FX_atof(wsArray[3].AsStringView());
+ int nMin = FX_atof(wsArray[4].AsStringView());
+ int nSec = FX_atof(wsArray[5].AsStringView());
+ int nYear = FX_atof(wsArray[7].AsStringView());
double dRet = JS_MakeDate(JS_MakeDay(nYear, nMonth - 1, nDay),
JS_MakeTime(nHour, nMin, nSec, 0));
if (std::isnan(dRet))
@@ -1193,7 +1191,7 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = L"AFDate_KeystrokeEx's parameters' size r not correct";
return false;
@@ -1205,15 +1203,15 @@ bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- CFX_WideString strValue = pEvent->Value();
+ WideString strValue = pEvent->Value();
if (strValue.IsEmpty())
return true;
- CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
+ WideString sFormat = params[0].ToCFXWideString(pRuntime);
bool bWrongFormat = false;
double dRet = MakeRegularDate(strValue, sFormat, &bWrongFormat);
if (bWrongFormat || std::isnan(dRet)) {
- CFX_WideString swMsg;
+ WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pContext, swMsg.c_str());
@@ -1227,7 +1225,7 @@ bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFDate_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1261,7 +1259,7 @@ bool CJS_PublicMethods::AFDate_Format(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFDate_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1295,7 +1293,7 @@ bool CJS_PublicMethods::AFDate_Keystroke(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFTime_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1316,7 +1314,7 @@ bool CJS_PublicMethods::AFTime_Format(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFTime_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1337,14 +1335,14 @@ bool CJS_PublicMethods::AFTime_Keystroke(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFTime_FormatEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return AFDate_FormatEx(pRuntime, params, vRet, sError);
}
bool CJS_PublicMethods::AFTime_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return AFDate_KeystrokeEx(pRuntime, params, vRet, sError);
}
@@ -1352,7 +1350,7 @@ bool CJS_PublicMethods::AFTime_KeystrokeEx(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFSpecial_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1363,8 +1361,8 @@ bool CJS_PublicMethods::AFSpecial_Format(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- CFX_WideString wsSource = pEvent->Value();
- CFX_WideString wsFormat;
+ WideString wsSource = pEvent->Value();
+ WideString wsFormat;
switch (params[0].ToInt(pRuntime)) {
case 0:
wsFormat = L"99999";
@@ -1392,7 +1390,7 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx(
CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1403,8 +1401,8 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx(
if (!pEvent->m_pValue)
return false;
- CFX_WideString& valEvent = pEvent->Value();
- CFX_WideString wstrMask = params[0].ToCFXWideString(pRuntime);
+ WideString& valEvent = pEvent->Value();
+ WideString wstrMask = params[0].ToCFXWideString(pRuntime);
if (wstrMask.IsEmpty())
return true;
@@ -1427,11 +1425,11 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx(
return true;
}
- CFX_WideString& wideChange = pEvent->Change();
+ WideString& wideChange = pEvent->Change();
if (wideChange.IsEmpty())
return true;
- CFX_WideString wChange = wideChange;
+ WideString wChange = wideChange;
FX_STRSIZE iIndexMask = pEvent->SelStart();
FX_STRSIZE combined_len = valEvent.GetLength() + wChange.GetLength() +
pEvent->SelStart() - pEvent->SelEnd();
@@ -1475,7 +1473,7 @@ bool CJS_PublicMethods::AFSpecial_Keystroke(
CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1513,7 +1511,7 @@ bool CJS_PublicMethods::AFSpecial_Keystroke(
bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1522,7 +1520,7 @@ bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime,
CJS_EventHandler* pEventHandler =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- CFX_WideString swValue;
+ WideString swValue;
if (pEventHandler->m_pValue)
swValue = pEventHandler->Value();
@@ -1531,7 +1529,7 @@ bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime,
return true;
}
- CFX_WideString prefix, postfix;
+ WideString prefix, postfix;
if (pEventHandler->SelStart() >= 0)
prefix = swValue.Left(pEventHandler->SelStart());
@@ -1553,17 +1551,17 @@ bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFParseDateEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString sValue = params[0].ToCFXWideString(pRuntime);
- CFX_WideString sFormat = params[1].ToCFXWideString(pRuntime);
+ WideString sValue = params[0].ToCFXWideString(pRuntime);
+ WideString sFormat = params[1].ToCFXWideString(pRuntime);
double dDate = MakeRegularDate(sValue, sFormat, nullptr);
if (std::isnan(dDate)) {
- CFX_WideString swMsg;
+ WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pRuntime->GetCurrentEventContext(), swMsg.c_str());
@@ -1577,7 +1575,7 @@ bool CJS_PublicMethods::AFParseDateEx(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFSimple(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 3) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1594,13 +1592,13 @@ bool CJS_PublicMethods::AFSimple(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFMakeNumber(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString ws = params[0].ToCFXWideString(pRuntime);
+ WideString ws = params[0].ToCFXWideString(pRuntime);
ws.Replace(L",", L".");
vRet = CJS_Value(pRuntime, ws.c_str());
vRet.MaybeCoerceToNumber(pRuntime);
@@ -1612,7 +1610,7 @@ bool CJS_PublicMethods::AFMakeNumber(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1628,7 +1626,7 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
pRuntime->GetFormFillEnv()->GetInterForm();
CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm();
- CFX_WideString sFunction = params[0].ToCFXWideString(pRuntime);
+ WideString sFunction = params[0].ToCFXWideString(pRuntime);
double dValue = wcscmp(sFunction.c_str(), L"PRD") == 0 ? 1.0 : 0.0;
CJS_Array FieldNameArray = AF_MakeArrayFromList(pRuntime, params1);
@@ -1637,7 +1635,7 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
for (int i = 0, isz = FieldNameArray.GetLength(pRuntime); i < isz; i++) {
CJS_Value jsValue(pRuntime);
FieldNameArray.GetElement(pRuntime, i, jsValue);
- CFX_WideString wsFieldName = jsValue.ToCFXWideString(pRuntime);
+ WideString wsFieldName = jsValue.ToCFXWideString(pRuntime);
for (int j = 0, jsz = pInterForm->CountFields(wsFieldName); j < jsz; j++) {
if (CPDF_FormField* pFormField = pInterForm->GetField(j, wsFieldName)) {
@@ -1645,10 +1643,10 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
switch (pFormField->GetFieldType()) {
case FIELDTYPE_TEXTFIELD:
case FIELDTYPE_COMBOBOX: {
- CFX_WideString trimmed = pFormField->GetValue();
+ WideString trimmed = pFormField->GetValue();
trimmed.TrimRight();
trimmed.TrimLeft();
- dTemp = FX_atof(trimmed.AsStringC());
+ dTemp = FX_atof(trimmed.AsStringView());
} break;
case FIELDTYPE_PUSHBUTTON: {
dTemp = 0.0;
@@ -1659,10 +1657,10 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
for (int c = 0, csz = pFormField->CountControls(); c < csz; c++) {
if (CPDF_FormControl* pFormCtrl = pFormField->GetControl(c)) {
if (pFormCtrl->IsChecked()) {
- CFX_WideString trimmed = pFormCtrl->GetExportValue();
+ WideString trimmed = pFormCtrl->GetExportValue();
trimmed.TrimRight();
trimmed.TrimLeft();
- dTemp = FX_atof(trimmed.AsStringC());
+ dTemp = FX_atof(trimmed.AsStringView());
break;
}
}
@@ -1670,10 +1668,10 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
} break;
case FIELDTYPE_LISTBOX: {
if (pFormField->CountSelectedItems() <= 1) {
- CFX_WideString trimmed = pFormField->GetValue();
+ WideString trimmed = pFormField->GetValue();
trimmed.TrimRight();
trimmed.TrimLeft();
- dTemp = FX_atof(trimmed.AsStringC());
+ dTemp = FX_atof(trimmed.AsStringView());
}
} break;
default:
@@ -1711,7 +1709,7 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 4) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -1724,13 +1722,12 @@ bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime,
if (pEvent->Value().IsEmpty())
return true;
- double dEentValue =
- atof(CFX_ByteString::FromUnicode(pEvent->Value()).c_str());
+ double dEentValue = atof(ByteString::FromUnicode(pEvent->Value()).c_str());
bool bGreaterThan = params[0].ToBool(pRuntime);
double dGreaterThan = params[1].ToDouble(pRuntime);
bool bLessThan = params[2].ToBool(pRuntime);
double dLessThan = params[3].ToDouble(pRuntime);
- CFX_WideString swMsg;
+ WideString swMsg;
if (bGreaterThan && bLessThan) {
if (dEentValue < dGreaterThan || dEentValue > dLessThan)
@@ -1757,17 +1754,17 @@ bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime,
bool CJS_PublicMethods::AFExtractNums(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString str = params[0].ToCFXWideString(pRuntime);
+ WideString str = params[0].ToCFXWideString(pRuntime);
if (str.GetLength() > 0 && (str[0] == L'.' || str[0] == L','))
str = L"0" + str;
- CFX_WideString sPart;
+ WideString sPart;
CJS_Array nums;
int nIndex = 0;
for (const auto& wc : str) {
diff --git a/fpdfsdk/javascript/PublicMethods.h b/fpdfsdk/javascript/PublicMethods.h
index c373f51322..365df3e5dc 100644
--- a/fpdfsdk/javascript/PublicMethods.h
+++ b/fpdfsdk/javascript/PublicMethods.h
@@ -21,91 +21,91 @@ class CJS_PublicMethods : public CJS_Object {
static bool AFNumber_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFNumber_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFPercent_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFPercent_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFDate_FormatEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFDate_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFDate_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFTime_FormatEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError); //
+ WideString& sError); //
static bool AFTime_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFTime_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFTime_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFSpecial_Format(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFSpecial_Keystroke(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFSpecial_KeystrokeEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError); //
+ WideString& sError); //
static bool AFSimple(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFMakeNumber(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFSimple_Calculate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFRange_Validate(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFMergeChange(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFParseDateEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static bool AFExtractNums(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
JS_STATIC_GLOBAL_FUN(AFNumber_Format);
JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
@@ -132,23 +132,21 @@ class CJS_PublicMethods : public CJS_Object {
JS_STATIC_DECLARE_GLOBAL_FUN();
- static int ParseStringInteger(const CFX_WideString& string,
+ static int ParseStringInteger(const WideString& string,
FX_STRSIZE nStart,
FX_STRSIZE& nSkip,
FX_STRSIZE nMaxStep);
- static CFX_WideString ParseStringString(const CFX_WideString& string,
- FX_STRSIZE nStart,
- FX_STRSIZE& nSkip);
- static double MakeRegularDate(const CFX_WideString& value,
- const CFX_WideString& format,
+ static WideString ParseStringString(const WideString& string,
+ FX_STRSIZE nStart,
+ FX_STRSIZE& nSkip);
+ static double MakeRegularDate(const WideString& value,
+ const WideString& format,
bool* bWrongFormat);
- static CFX_WideString MakeFormatDate(double dDate,
- const CFX_WideString& format);
- static double ParseNormalDate(const CFX_WideString& value,
- bool* bWrongFormat);
- static double MakeInterDate(const CFX_WideString& value);
+ static WideString MakeFormatDate(double dDate, const WideString& format);
+ static double ParseNormalDate(const WideString& value, bool* bWrongFormat);
+ static double MakeInterDate(const WideString& value);
- static bool IsNumber(const CFX_WideString& str);
+ static bool IsNumber(const WideString& str);
static bool maskSatisfied(wchar_t c_Change, wchar_t c_Mask);
static bool isReservedMaskChar(wchar_t ch);
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index 246db66234..3c0f9af286 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -28,7 +28,7 @@ class GlobalTimer {
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CJS_Runtime* pRuntime,
int nType,
- const CFX_WideString& script,
+ const WideString& script,
uint32_t dwElapse,
uint32_t dwTimeOut);
~GlobalTimer();
@@ -40,7 +40,7 @@ class GlobalTimer {
uint32_t GetTimeOut() const { return m_dwTimeOut; }
int GetTimerID() const { return m_nTimerID; }
CJS_Runtime* GetRuntime() const { return m_pRuntime.Get(); }
- CFX_WideString GetJScript() const { return m_swJScript; }
+ WideString GetJScript() const { return m_swJScript; }
private:
using TimerMap = std::map<uint32_t, GlobalTimer*>;
@@ -53,7 +53,7 @@ class GlobalTimer {
// data
const int m_nType; // 0:Interval; 1:TimeOut
const uint32_t m_dwTimeOut;
- const CFX_WideString m_swJScript;
+ const WideString m_swJScript;
CJS_Runtime::ObservedPtr m_pRuntime;
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
};
@@ -62,7 +62,7 @@ GlobalTimer::GlobalTimer(app* pObj,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CJS_Runtime* pRuntime,
int nType,
- const CFX_WideString& script,
+ const WideString& script,
uint32_t dwElapse,
uint32_t dwTimeOut)
: m_nTimerID(0),
@@ -209,7 +209,7 @@ app::~app() {
bool app::activeDocs(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -230,7 +230,7 @@ bool app::activeDocs(CJS_Runtime* pRuntime,
bool app::calculate(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
bool bVP;
vp >> bVP;
@@ -244,7 +244,7 @@ bool app::calculate(CJS_Runtime* pRuntime,
bool app::formsVersion(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << JS_NUM_FORMSVERSION;
return true;
@@ -255,7 +255,7 @@ bool app::formsVersion(CJS_Runtime* pRuntime,
bool app::viewerType(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << JS_STR_VIEWERTYPE;
return true;
@@ -266,7 +266,7 @@ bool app::viewerType(CJS_Runtime* pRuntime,
bool app::viewerVariation(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsGetting()) {
vp << JS_STR_VIEWERVARIATION;
return true;
@@ -277,7 +277,7 @@ bool app::viewerVariation(CJS_Runtime* pRuntime,
bool app::viewerVersion(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
#ifdef PDF_ENABLE_XFA
@@ -294,14 +294,14 @@ bool app::viewerVersion(CJS_Runtime* pRuntime,
bool app::platform(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
#ifdef PDF_ENABLE_XFA
CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
if (!pFormFillEnv)
return false;
- CFX_WideString platfrom = pFormFillEnv->GetPlatform();
+ WideString platfrom = pFormFillEnv->GetPlatform();
if (!platfrom.IsEmpty()) {
vp << platfrom;
return true;
@@ -313,14 +313,14 @@ bool app::platform(CJS_Runtime* pRuntime,
bool app::language(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
#ifdef PDF_ENABLE_XFA
CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
if (!pFormFillEnv)
return false;
- CFX_WideString language = pFormFillEnv->GetLanguage();
+ WideString language = pFormFillEnv->GetLanguage();
if (!language.IsEmpty()) {
vp << language;
return true;
@@ -337,7 +337,7 @@ bool app::language(CJS_Runtime* pRuntime,
bool app::newFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
// opens a specified pdf document and returns its document object
@@ -350,14 +350,14 @@ bool app::newFDF(CJS_Runtime* pRuntime,
bool app::openFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool app::alert(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CJS_Value> newParams = JS_ExpandKeywordParams(
pRuntime, params, 4, L"cMsg", L"nIcon", L"nType", L"cTitle");
@@ -372,7 +372,7 @@ bool app::alert(CJS_Runtime* pRuntime,
return true;
}
- CFX_WideString swMsg;
+ WideString swMsg;
if (newParams[0].GetType() == CJS_Value::VT_object) {
CJS_Array carray;
if (newParams[0].ConvertToArray(pRuntime, carray)) {
@@ -400,7 +400,7 @@ bool app::alert(CJS_Runtime* pRuntime,
if (newParams[2].GetType() != CJS_Value::VT_unknown)
iType = newParams[2].ToInt(pRuntime);
- CFX_WideString swTitle;
+ WideString swTitle;
if (newParams[3].GetType() != CJS_Value::VT_unknown)
swTitle = newParams[3].ToCFXWideString(pRuntime);
else
@@ -418,7 +418,7 @@ bool app::alert(CJS_Runtime* pRuntime,
bool app::beep(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() == 1) {
pRuntime->GetFormFillEnv()->JS_appBeep(params[0].ToInt(pRuntime));
return true;
@@ -431,31 +431,31 @@ bool app::beep(CJS_Runtime* pRuntime,
bool app::findComponent(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool app::popUpMenuEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
-bool app::fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError) {
+bool app::fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return false;
}
bool app::setInterval(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() > 2 || params.size() == 0) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString script =
+ WideString script =
params.size() > 0 ? params[0].ToCFXWideString(pRuntime) : L"";
if (script.IsEmpty()) {
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
@@ -485,13 +485,13 @@ bool app::setInterval(CJS_Runtime* pRuntime,
bool app::setTimeOut(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() > 2 || params.size() == 0) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString script = params[0].ToCFXWideString(pRuntime);
+ WideString script = params[0].ToCFXWideString(pRuntime);
if (script.IsEmpty()) {
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
return true;
@@ -519,7 +519,7 @@ bool app::setTimeOut(CJS_Runtime* pRuntime,
bool app::clearTimeOut(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -532,7 +532,7 @@ bool app::clearTimeOut(CJS_Runtime* pRuntime,
bool app::clearInterval(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -564,7 +564,7 @@ void app::ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param) {
bool app::execMenuItem(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
@@ -578,11 +578,11 @@ void app::CancelProc(GlobalTimer* pTimer) {
m_Timers.erase(pdfium::FakeUniquePtr<GlobalTimer>(pTimer));
}
-void app::RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript) {
+void app::RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript) {
if (!pRuntime->IsBlocking()) {
IJS_EventContext* pContext = pRuntime->NewEventContext();
pContext->OnExternal_Exec();
- CFX_WideString wtInfo;
+ WideString wtInfo;
pContext->RunScript(wsScript, &wtInfo);
pRuntime->ReleaseEventContext(pContext);
}
@@ -591,7 +591,7 @@ void app::RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript) {
bool app::goBack(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Not supported.
return true;
}
@@ -599,7 +599,7 @@ bool app::goBack(CJS_Runtime* pRuntime,
bool app::goForward(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Not supported.
return true;
}
@@ -607,7 +607,7 @@ bool app::goForward(CJS_Runtime* pRuntime,
bool app::mailMsg(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CJS_Value> newParams =
JS_ExpandKeywordParams(pRuntime, params, 6, L"bUI", L"cTo", L"cCc",
L"cBcc", L"cSubject", L"cMsg");
@@ -618,7 +618,7 @@ bool app::mailMsg(CJS_Runtime* pRuntime,
}
bool bUI = newParams[0].ToBool(pRuntime);
- CFX_WideString cTo;
+ WideString cTo;
if (newParams[1].GetType() != CJS_Value::VT_unknown) {
cTo = newParams[1].ToCFXWideString(pRuntime);
} else {
@@ -629,19 +629,19 @@ bool app::mailMsg(CJS_Runtime* pRuntime,
}
}
- CFX_WideString cCc;
+ WideString cCc;
if (newParams[2].GetType() != CJS_Value::VT_unknown)
cCc = newParams[2].ToCFXWideString(pRuntime);
- CFX_WideString cBcc;
+ WideString cBcc;
if (newParams[3].GetType() != CJS_Value::VT_unknown)
cBcc = newParams[3].ToCFXWideString(pRuntime);
- CFX_WideString cSubject;
+ WideString cSubject;
if (newParams[4].GetType() != CJS_Value::VT_unknown)
cSubject = newParams[4].ToCFXWideString(pRuntime);
- CFX_WideString cMsg;
+ WideString cMsg;
if (newParams[5].GetType() != CJS_Value::VT_unknown)
cMsg = newParams[5].ToCFXWideString(pRuntime);
@@ -656,14 +656,14 @@ bool app::mailMsg(CJS_Runtime* pRuntime,
bool app::launchURL(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
bool app::runtimeHighlight(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
vp >> m_bRuntimeHighLight;
} else {
@@ -674,27 +674,27 @@ bool app::runtimeHighlight(CJS_Runtime* pRuntime,
bool app::fullscreen(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool app::popUpMenu(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool app::browseForDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
-CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) {
- CFX_WideString sRet = L"/";
+WideString app::SysPathToPDFPath(const WideString& sOldPath) {
+ WideString sRet = L"/";
for (const wchar_t& c : sOldPath) {
if (c != L':')
sRet += (c == L'\\') ? L'/' : c;
@@ -705,21 +705,21 @@ CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) {
bool app::newDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool app::openDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return false;
}
bool app::response(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
std::vector<CJS_Value> newParams =
JS_ExpandKeywordParams(pRuntime, params, 5, L"cQuestion", L"cTitle",
L"cDefault", L"bPassword", L"cLabel");
@@ -728,13 +728,13 @@ bool app::response(CJS_Runtime* pRuntime,
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
}
- CFX_WideString swQuestion = newParams[0].ToCFXWideString(pRuntime);
+ WideString swQuestion = newParams[0].ToCFXWideString(pRuntime);
- CFX_WideString swTitle = L"PDF";
+ WideString swTitle = L"PDF";
if (newParams[1].GetType() != CJS_Value::VT_unknown)
swTitle = newParams[1].ToCFXWideString(pRuntime);
- CFX_WideString swDefault;
+ WideString swDefault;
if (newParams[2].GetType() != CJS_Value::VT_unknown)
swDefault = newParams[2].ToCFXWideString(pRuntime);
@@ -742,7 +742,7 @@ bool app::response(CJS_Runtime* pRuntime,
if (newParams[3].GetType() != CJS_Value::VT_unknown)
bPassword = newParams[3].ToBool(pRuntime);
- CFX_WideString swLabel;
+ WideString swLabel;
if (newParams[4].GetType() != CJS_Value::VT_unknown)
swLabel = newParams[4].ToCFXWideString(pRuntime);
@@ -757,7 +757,7 @@ bool app::response(CJS_Runtime* pRuntime,
return false;
}
- vRet = CJS_Value(pRuntime, CFX_WideString::FromUTF16LE(
+ vRet = CJS_Value(pRuntime, WideString::FromUTF16LE(
reinterpret_cast<uint16_t*>(pBuff.data()),
nLengthBytes / sizeof(uint16_t))
.c_str());
@@ -765,15 +765,13 @@ bool app::response(CJS_Runtime* pRuntime,
return true;
}
-bool app::media(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return false;
}
bool app::execDialog(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
diff --git a/fpdfsdk/javascript/app.h b/fpdfsdk/javascript/app.h
index 0a2cfdb58e..e77c8cd57b 100644
--- a/fpdfsdk/javascript/app.h
+++ b/fpdfsdk/javascript/app.h
@@ -41,132 +41,120 @@ class app : public CJS_EmbedObj {
explicit app(CJS_Object* pJSObject);
~app() override;
- bool activeDocs(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool calculate(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ bool activeDocs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool calculate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool formsVersion(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool fullscreen(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool language(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool platform(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool fullscreen(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool language(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool platform(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool runtimeHighlight(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool viewerType(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool viewerType(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool viewerVariation(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool viewerVersion(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool alert(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool beep(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool browseForDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool clearInterval(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool clearTimeOut(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool execDialog(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool execMenuItem(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool findComponent(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool goBack(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool goForward(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool launchURL(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool mailMsg(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool newFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool newDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool openDoc(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool openFDF(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool popUpMenuEx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool popUpMenu(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool response(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setInterval(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool setTimeOut(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
void TimerProc(GlobalTimer* pTimer);
void CancelProc(GlobalTimer* pTimer);
- static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath);
+ static WideString SysPathToPDFPath(const WideString& sOldPath);
private:
// CJS_EmbedObj
- void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript);
+ void RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript);
void ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param);
diff --git a/fpdfsdk/javascript/cjs_event_context.cpp b/fpdfsdk/javascript/cjs_event_context.cpp
index 9537ac984e..b820bc309b 100644
--- a/fpdfsdk/javascript/cjs_event_context.cpp
+++ b/fpdfsdk/javascript/cjs_event_context.cpp
@@ -24,8 +24,7 @@ CPDFSDK_FormFillEnvironment* CJS_EventContext::GetFormFillEnv() {
return m_pRuntime->GetFormFillEnv();
}
-bool CJS_EventContext::RunScript(const CFX_WideString& script,
- CFX_WideString* info) {
+bool CJS_EventContext::RunScript(const WideString& script, WideString* info) {
v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate());
v8::HandleScope handle_scope(m_pRuntime->GetIsolate());
v8::Local<v8::Context> context = m_pRuntime->NewLocalContext();
@@ -47,7 +46,7 @@ bool CJS_EventContext::RunScript(const CFX_WideString& script,
return false;
}
- CFX_WideString sErrorMessage;
+ WideString sErrorMessage;
int nRet = 0;
if (script.GetLength() > 0)
nRet = m_pRuntime->ExecuteScript(script.c_str(), &sErrorMessage);
@@ -67,7 +66,7 @@ void CJS_EventContext::OnApp_Init() {
}
void CJS_EventContext::OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) {
+ const WideString& strTargetName) {
m_pEventHandler->OnDoc_Open(pFormFillEnv, strTargetName);
}
@@ -141,39 +140,39 @@ void CJS_EventContext::OnField_MouseUp(bool bModifier,
void CJS_EventContext::OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) {
+ const WideString& Value) {
m_pEventHandler->OnField_Focus(bModifier, bShift, pTarget, Value);
}
void CJS_EventContext::OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) {
+ const WideString& Value) {
m_pEventHandler->OnField_Blur(bModifier, bShift, pTarget, Value);
}
void CJS_EventContext::OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) {
m_pEventHandler->OnField_Calculate(pSource, pTarget, Value, bRc);
}
void CJS_EventContext::OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) {
m_pEventHandler->OnField_Format(pTarget, Value, bWillCommit);
}
-void CJS_EventContext::OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+void CJS_EventContext::OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) {
@@ -182,13 +181,13 @@ void CJS_EventContext::OnField_Keystroke(CFX_WideString& strChange,
pTarget, Value, bWillCommit, bFieldFull, bRc);
}
-void CJS_EventContext::OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+void CJS_EventContext::OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) {
m_pEventHandler->OnField_Validate(strChange, strChangeEx, bKeyDown, bModifier,
bShift, pTarget, Value, bRc);
@@ -276,6 +275,6 @@ void CJS_EventContext::OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
}
void CJS_EventContext::OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) {
+ const WideString& strTargetName) {
m_pEventHandler->OnMenu_Exec(pFormFillEnv, strTargetName);
}
diff --git a/fpdfsdk/javascript/cjs_event_context.h b/fpdfsdk/javascript/cjs_event_context.h
index 715bd9462b..a27bbd73af 100644
--- a/fpdfsdk/javascript/cjs_event_context.h
+++ b/fpdfsdk/javascript/cjs_event_context.h
@@ -24,10 +24,10 @@ class CJS_EventContext : public IJS_EventContext {
~CJS_EventContext() override;
// IJS_EventContext
- bool RunScript(const CFX_WideString& script, CFX_WideString* info) override;
+ bool RunScript(const WideString& script, WideString* info) override;
void OnApp_Init() override;
void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) override;
+ const WideString& strTargetName) override;
void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
@@ -52,37 +52,37 @@ class CJS_EventContext : public IJS_EventContext {
void OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) override;
+ const WideString& Value) override;
void OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) override;
+ const WideString& Value) override;
void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) override;
void OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) override;
- void OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) override;
- void OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ void OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) override;
void OnScreen_Focus(bool bModifier,
bool bShift,
@@ -117,7 +117,7 @@ class CJS_EventContext : public IJS_EventContext {
void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override;
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) override;
+ const WideString& strTargetName) override;
void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnConsole_Exec() override;
void OnExternal_Exec() override;
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp
index 515bdcb65f..720a15b4bd 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -193,8 +193,7 @@ CPDFSDK_FormFillEnvironment* CJS_Runtime::GetFormFillEnv() const {
return m_pFormFillEnv.Get();
}
-int CJS_Runtime::ExecuteScript(const CFX_WideString& script,
- CFX_WideString* info) {
+int CJS_Runtime::ExecuteScript(const WideString& script, WideString* info) {
FXJSErr error = {};
int nRet = Execute(script, &error);
if (nRet < 0) {
@@ -213,13 +212,13 @@ void CJS_Runtime::RemoveEventFromSet(const FieldEvent& event) {
}
#ifdef PDF_ENABLE_XFA
-CFX_WideString ChangeObjName(const CFX_WideString& str) {
- CFX_WideString sRet = str;
+WideString ChangeObjName(const WideString& str) {
+ WideString sRet = str;
sRet.Replace(L"_", L".");
return sRet;
}
-bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
+bool CJS_Runtime::GetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) {
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::HandleScope handle_scope(GetIsolate());
@@ -236,7 +235,7 @@ bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
return true;
}
-bool CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name,
+bool CJS_Runtime::SetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) {
if (utf8Name.IsEmpty() || !pValue)
return false;
diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h
index bfbc52b116..39919957f8 100644
--- a/fpdfsdk/javascript/cjs_runtime.h
+++ b/fpdfsdk/javascript/cjs_runtime.h
@@ -25,7 +25,7 @@ class CJS_Runtime : public IJS_Runtime,
public CFXJS_Engine,
public CFX_Observable<CJS_Runtime> {
public:
- using FieldEvent = std::pair<CFX_WideString, JS_EVENT_T>;
+ using FieldEvent = std::pair<WideString, JS_EVENT_T>;
static CJS_Runtime* CurrentRuntimeFromIsolate(v8::Isolate* pIsolate);
@@ -36,8 +36,7 @@ class CJS_Runtime : public IJS_Runtime,
IJS_EventContext* NewEventContext() override;
void ReleaseEventContext(IJS_EventContext* pContext) override;
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override;
- int ExecuteScript(const CFX_WideString& script,
- CFX_WideString* info) override;
+ int ExecuteScript(const WideString& script, WideString* info) override;
CJS_EventContext* GetCurrentEventContext() const;
@@ -50,9 +49,9 @@ class CJS_Runtime : public IJS_Runtime,
bool IsBlocking() const { return m_bBlocking; }
#ifdef PDF_ENABLE_XFA
- bool GetValueByName(const CFX_ByteStringC& utf8Name,
+ bool GetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) override;
- bool SetValueByName(const CFX_ByteStringC& utf8Name,
+ bool SetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) override;
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp
index 7bf3cc9c6f..574c81a3c0 100644
--- a/fpdfsdk/javascript/color.cpp
+++ b/fpdfsdk/javascript/color.cpp
@@ -91,7 +91,7 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
CJS_Value value(pRuntime);
array.GetElement(pRuntime, 0, value);
- CFX_ByteString sSpace = value.ToCFXByteString(pRuntime);
+ ByteString sSpace = value.ToCFXByteString(pRuntime);
double d1 = 0;
double d2 = 0;
@@ -132,73 +132,65 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
bool color::transparent(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crTransparent);
}
bool color::black(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crBlack);
}
bool color::white(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crWhite);
}
-bool color::red(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool color::red(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crRed);
}
bool color::green(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crGreen);
}
-bool color::blue(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool color::blue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crBlue);
}
-bool color::cyan(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool color::cyan(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crCyan);
}
bool color::magenta(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crMagenta);
}
bool color::yellow(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crYellow);
}
bool color::dkGray(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crDKGray);
}
-bool color::gray(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool color::gray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crGray);
}
bool color::ltGray(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return PropertyHelper(pRuntime, vp, &m_crLTGray);
}
@@ -221,7 +213,7 @@ bool color::PropertyHelper(CJS_Runtime* pRuntime,
bool color::convert(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
int iSize = params.size();
if (iSize < 2)
return false;
@@ -233,7 +225,7 @@ bool color::convert(CJS_Runtime* pRuntime,
CFX_Color crSource;
ConvertArrayToPWLColor(pRuntime, aSource, &crSource);
- CFX_ByteString sDestSpace = params[1].ToCFXByteString(pRuntime);
+ ByteString sDestSpace = params[1].ToCFXByteString(pRuntime);
int nColorType = COLORTYPE_TRANSPARENT;
if (sDestSpace == "T") {
@@ -257,7 +249,7 @@ bool color::convert(CJS_Runtime* pRuntime,
bool color::equal(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 2)
return false;
diff --git a/fpdfsdk/javascript/color.h b/fpdfsdk/javascript/color.h
index 5d6a65790c..5e1e871064 100644
--- a/fpdfsdk/javascript/color.h
+++ b/fpdfsdk/javascript/color.h
@@ -17,31 +17,29 @@ class color : public CJS_EmbedObj {
explicit color(CJS_Object* pJSObject);
~color() override;
- bool black(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool blue(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool cyan(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool dkGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool gray(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool green(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool ltGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool magenta(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool red(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ bool black(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool blue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool cyan(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool dkGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool gray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool green(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool ltGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool magenta(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool red(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool transparent(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool white(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool yellow(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
+ WideString& sError);
+ bool white(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool yellow(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool convert(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool equal(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
static void ConvertPWLColorToArray(CJS_Runtime* pRuntime,
const CFX_Color& color,
diff --git a/fpdfsdk/javascript/console.cpp b/fpdfsdk/javascript/console.cpp
index e9d130820f..4f0fd43ac4 100644
--- a/fpdfsdk/javascript/console.cpp
+++ b/fpdfsdk/javascript/console.cpp
@@ -33,21 +33,21 @@ console::~console() {}
bool console::clear(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool console::hide(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool console::println(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 1) {
return false;
}
@@ -57,6 +57,6 @@ bool console::println(CJS_Runtime* pRuntime,
bool console::show(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
diff --git a/fpdfsdk/javascript/console.h b/fpdfsdk/javascript/console.h
index a7e4d8ed9b..4680220a81 100644
--- a/fpdfsdk/javascript/console.h
+++ b/fpdfsdk/javascript/console.h
@@ -20,19 +20,19 @@ class console : public CJS_EmbedObj {
bool clear(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool hide(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool println(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool show(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
};
class CJS_Console : public CJS_Object {
diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp
index 2b00cbc10e..efc704da94 100644
--- a/fpdfsdk/javascript/event.cpp
+++ b/fpdfsdk/javascript/event.cpp
@@ -48,10 +48,10 @@ event::~event() {}
bool event::change(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- CFX_WideString& wChange = pEvent->Change();
+ WideString& wChange = pEvent->Change();
if (vp.IsSetting()) {
if (vp.GetJSValue()->GetType() == CJS_Value::VT_string)
vp >> wChange;
@@ -63,7 +63,7 @@ bool event::change(CJS_Runtime* pRuntime,
bool event::changeEx(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -76,7 +76,7 @@ bool event::changeEx(CJS_Runtime* pRuntime,
bool event::commitKey(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -89,7 +89,7 @@ bool event::commitKey(CJS_Runtime* pRuntime,
bool event::fieldFull(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -103,7 +103,7 @@ bool event::fieldFull(CJS_Runtime* pRuntime,
bool event::keyDown(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -116,7 +116,7 @@ bool event::keyDown(CJS_Runtime* pRuntime,
bool event::modifier(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -127,9 +127,7 @@ bool event::modifier(CJS_Runtime* pRuntime,
return true;
}
-bool event::name(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -140,9 +138,7 @@ bool event::name(CJS_Runtime* pRuntime,
return true;
}
-bool event::rc(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::rc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -157,25 +153,25 @@ bool event::rc(CJS_Runtime* pRuntime,
bool event::richChange(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool event::richChangeEx(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool event::richValue(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
return true;
}
bool event::selEnd(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -193,7 +189,7 @@ bool event::selEnd(CJS_Runtime* pRuntime,
bool event::selStart(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -211,7 +207,7 @@ bool event::selStart(CJS_Runtime* pRuntime,
bool event::shift(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -224,7 +220,7 @@ bool event::shift(CJS_Runtime* pRuntime,
bool event::source(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -237,7 +233,7 @@ bool event::source(CJS_Runtime* pRuntime,
bool event::target(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -250,7 +246,7 @@ bool event::target(CJS_Runtime* pRuntime,
bool event::targetName(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -261,9 +257,7 @@ bool event::targetName(CJS_Runtime* pRuntime,
return true;
}
-bool event::type(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) {
if (!vp.IsGetting())
return false;
@@ -276,7 +270,7 @@ bool event::type(CJS_Runtime* pRuntime,
bool event::value(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -286,7 +280,7 @@ bool event::value(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- CFX_WideString& val = pEvent->Value();
+ WideString& val = pEvent->Value();
if (vp.IsSetting())
vp >> val;
else
@@ -297,7 +291,7 @@ bool event::value(CJS_Runtime* pRuntime,
bool event::willCommit(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (!vp.IsGetting())
return false;
diff --git a/fpdfsdk/javascript/event.h b/fpdfsdk/javascript/event.h
index 2be8a0adb2..857423784e 100644
--- a/fpdfsdk/javascript/event.h
+++ b/fpdfsdk/javascript/event.h
@@ -15,48 +15,28 @@ class event : public CJS_EmbedObj {
~event() override;
public:
- bool change(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool changeEx(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool commitKey(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool fieldFull(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool keyDown(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool modifier(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool rc(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool richChange(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ bool change(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool changeEx(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool commitKey(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool fieldFull(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool keyDown(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool modifier(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool rc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool richChange(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
bool richChangeEx(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CFX_WideString& sError);
- bool richValue(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool selEnd(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool selStart(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool shift(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool target(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool targetName(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError);
- bool willCommit(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
+ bool richValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool selEnd(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool selStart(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool shift(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool target(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool targetName(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
+ bool willCommit(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
};
class CJS_Event : public CJS_Object {
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index 8dcddf4339..9827b2aae7 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -62,13 +62,13 @@ void JSGlobalAlternate::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
}
bool JSGlobalAlternate::QueryProperty(const wchar_t* propname) {
- return CFX_WideString(propname) != L"setPersistent";
+ return WideString(propname) != L"setPersistent";
}
bool JSGlobalAlternate::DelProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
- CFX_WideString& sError) {
- auto it = m_MapGlobal.find(CFX_ByteString::FromUnicode(propname));
+ WideString& sError) {
+ auto it = m_MapGlobal.find(ByteString::FromUnicode(propname));
if (it == m_MapGlobal.end())
return false;
@@ -79,9 +79,9 @@ bool JSGlobalAlternate::DelProperty(CJS_Runtime* pRuntime,
bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
CJS_PropValue& vp,
- CFX_WideString& sError) {
+ WideString& sError) {
if (vp.IsSetting()) {
- CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname);
+ ByteString sPropName = ByteString::FromUnicode(propname);
switch (vp.GetJSValue()->GetType()) {
case CJS_Value::VT_number: {
double dData;
@@ -96,7 +96,7 @@ bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime,
bData, "", v8::Local<v8::Object>(), false);
}
case CJS_Value::VT_string: {
- CFX_ByteString sData;
+ ByteString sData;
vp >> sData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::STRING, 0,
false, sData, v8::Local<v8::Object>(), false);
@@ -119,7 +119,7 @@ bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime,
break;
}
} else {
- auto it = m_MapGlobal.find(CFX_ByteString::FromUnicode(propname));
+ auto it = m_MapGlobal.find(ByteString::FromUnicode(propname));
if (it == m_MapGlobal.end()) {
vp.GetJSValue()->SetNull(pRuntime);
return true;
@@ -158,7 +158,7 @@ bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime,
bool JSGlobalAlternate::setPersistent(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -202,7 +202,7 @@ void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
pData->bPersistent == 1);
pRuntime->PutObjectProperty(
m_pJSObject->ToV8Object(), pData->data.sKey.UTF8Decode(),
- pRuntime->NewString(pData->data.sData.UTF8Decode().AsStringC()));
+ pRuntime->NewString(pData->data.sData.UTF8Decode().AsStringView()));
break;
case JS_GlobalDataType::OBJECT: {
v8::Local<v8::Object> pObj = pRuntime->NewFxDynamicObj(-1);
@@ -229,7 +229,7 @@ void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
void JSGlobalAlternate::CommitGlobalPersisitentVariables(
CJS_Runtime* pRuntime) {
for (const auto& iter : m_MapGlobal) {
- CFX_ByteString name = iter.first;
+ ByteString name = iter.first;
JSGlobalData* pData = iter.second.get();
if (pData->bDeleted) {
m_pGlobalData->DeleteGlobalVariable(name);
@@ -267,9 +267,9 @@ void JSGlobalAlternate::CommitGlobalPersisitentVariables(
void JSGlobalAlternate::ObjectToArray(CJS_Runtime* pRuntime,
v8::Local<v8::Object> pObj,
CJS_GlobalVariableArray& array) {
- std::vector<CFX_WideString> pKeyList = pRuntime->GetObjectPropertyNames(pObj);
+ std::vector<WideString> pKeyList = pRuntime->GetObjectPropertyNames(pObj);
for (const auto& ws : pKeyList) {
- CFX_ByteString sKey = ws.UTF8Encode();
+ ByteString sKey = ws.UTF8Encode();
v8::Local<v8::Value> v = pRuntime->GetObjectProperty(pObj, ws);
switch (CJS_Value::GetValueType(v)) {
case CJS_Value::VT_number: {
@@ -287,8 +287,7 @@ void JSGlobalAlternate::ObjectToArray(CJS_Runtime* pRuntime,
array.Add(pObjElement);
} break;
case CJS_Value::VT_string: {
- CFX_ByteString sValue =
- CJS_Value(pRuntime, v).ToCFXByteString(pRuntime);
+ ByteString sValue = CJS_Value(pRuntime, v).ToCFXByteString(pRuntime);
CJS_KeyValue* pObjElement = new CJS_KeyValue;
pObjElement->nType = JS_GlobalDataType::STRING;
pObjElement->sKey = sKey;
@@ -333,7 +332,7 @@ void JSGlobalAlternate::PutObjectProperty(v8::Local<v8::Object> pObj,
case JS_GlobalDataType::STRING:
pRuntime->PutObjectProperty(
pObj, pObjData->sKey.UTF8Decode(),
- pRuntime->NewString(pObjData->sData.UTF8Decode().AsStringC()));
+ pRuntime->NewString(pObjData->sData.UTF8Decode().AsStringView()));
break;
case JS_GlobalDataType::OBJECT: {
v8::Local<v8::Object> pNewObj = pRuntime->NewFxDynamicObj(-1);
@@ -355,11 +354,11 @@ void JSGlobalAlternate::DestroyGlobalPersisitentVariables() {
m_MapGlobal.clear();
}
-bool JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname,
+bool JSGlobalAlternate::SetGlobalVariables(const ByteString& propname,
JS_GlobalDataType nType,
double dData,
bool bData,
- const CFX_ByteString& sData,
+ const ByteString& sData,
v8::Local<v8::Object> pData,
bool bDefaultPersistent) {
if (propname.IsEmpty())
diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h
index 364313c972..5005b2aeed 100644
--- a/fpdfsdk/javascript/global.h
+++ b/fpdfsdk/javascript/global.h
@@ -25,7 +25,7 @@ struct JSGlobalData {
JS_GlobalDataType nType;
double dData;
bool bData;
- CFX_ByteString sData;
+ ByteString sData;
v8::Global<v8::Object> pData;
bool bPersistent;
bool bDeleted;
@@ -39,26 +39,26 @@ class JSGlobalAlternate : public CJS_EmbedObj {
bool setPersistent(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool QueryProperty(const wchar_t* propname);
bool DoProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
CJS_PropValue& vp,
- CFX_WideString& sError);
+ WideString& sError);
bool DelProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
- CFX_WideString& sError);
+ WideString& sError);
void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv);
private:
void UpdateGlobalPersistentVariables();
void CommitGlobalPersisitentVariables(CJS_Runtime* pRuntime);
void DestroyGlobalPersisitentVariables();
- bool SetGlobalVariables(const CFX_ByteString& propname,
+ bool SetGlobalVariables(const ByteString& propname,
JS_GlobalDataType nType,
double dData,
bool bData,
- const CFX_ByteString& sData,
+ const ByteString& sData,
v8::Local<v8::Object> pData,
bool bDefaultPersistent);
void ObjectToArray(CJS_Runtime* pRuntime,
@@ -66,8 +66,8 @@ class JSGlobalAlternate : public CJS_EmbedObj {
CJS_GlobalVariableArray& array);
void PutObjectProperty(v8::Local<v8::Object> obj, CJS_KeyValue* pData);
- std::map<CFX_ByteString, std::unique_ptr<JSGlobalData>> m_MapGlobal;
- CFX_WideString m_sFilePath;
+ std::map<ByteString, std::unique_ptr<JSGlobalData>> m_MapGlobal;
+ WideString m_sFilePath;
CJS_GlobalData* m_pGlobalData;
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
};
diff --git a/fpdfsdk/javascript/ijs_event_context.h b/fpdfsdk/javascript/ijs_event_context.h
index 8428072cdd..5d2d712e96 100644
--- a/fpdfsdk/javascript/ijs_event_context.h
+++ b/fpdfsdk/javascript/ijs_event_context.h
@@ -20,13 +20,12 @@ class CPDFSDK_FormFillEnvironment;
// may trigger new events on top of one another.
class IJS_EventContext {
public:
- virtual bool RunScript(const CFX_WideString& script,
- CFX_WideString* info) = 0;
+ virtual bool RunScript(const WideString& script, WideString* info) = 0;
virtual void OnApp_Init() = 0;
virtual void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString& strTargetName) = 0;
+ const WideString& strTargetName) = 0;
virtual void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
virtual void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
virtual void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
@@ -53,38 +52,38 @@ class IJS_EventContext {
virtual void OnField_Focus(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) = 0;
+ const WideString& Value) = 0;
virtual void OnField_Blur(bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- const CFX_WideString& Value) = 0;
+ const WideString& Value) = 0;
virtual void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) = 0;
virtual void OnField_Format(CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit) = 0;
- virtual void OnField_Keystroke(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ virtual void OnField_Keystroke(WideString& strChange,
+ const WideString& strChangeEx,
bool KeyDown,
bool bModifier,
int& nSelEnd,
int& nSelStart,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool bWillCommit,
bool bFieldFull,
bool& bRc) = 0;
- virtual void OnField_Validate(CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ virtual void OnField_Validate(WideString& strChange,
+ const WideString& strChangeEx,
bool bKeyDown,
bool bModifier,
bool bShift,
CPDF_FormField* pTarget,
- CFX_WideString& Value,
+ WideString& Value,
bool& bRc) = 0;
virtual void OnScreen_Focus(bool bModifier,
@@ -122,7 +121,7 @@ class IJS_EventContext {
virtual void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
virtual void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- const CFX_WideString&) = 0;
+ const WideString&) = 0;
virtual void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
virtual void OnConsole_Exec() = 0;
virtual void OnExternal_Exec() = 0;
diff --git a/fpdfsdk/javascript/ijs_runtime.h b/fpdfsdk/javascript/ijs_runtime.h
index babc41842c..a21ce809ac 100644
--- a/fpdfsdk/javascript/ijs_runtime.h
+++ b/fpdfsdk/javascript/ijs_runtime.h
@@ -28,13 +28,12 @@ class IJS_Runtime {
virtual IJS_EventContext* NewEventContext() = 0;
virtual void ReleaseEventContext(IJS_EventContext* pContext) = 0;
virtual CPDFSDK_FormFillEnvironment* GetFormFillEnv() const = 0;
- virtual int ExecuteScript(const CFX_WideString& script,
- CFX_WideString* info) = 0;
+ virtual int ExecuteScript(const WideString& script, WideString* info) = 0;
#ifdef PDF_ENABLE_XFA
- virtual bool GetValueByName(const CFX_ByteStringC& utf8Name,
+ virtual bool GetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) = 0;
- virtual bool SetValueByName(const CFX_ByteStringC& utf8Name,
+ virtual bool SetValueByName(const ByteStringView& utf8Name,
CFXJSE_Value* pValue) = 0;
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/javascript/public_methods_embeddertest.cpp b/fpdfsdk/javascript/public_methods_embeddertest.cpp
index 24793667b0..f6af01f4c1 100644
--- a/fpdfsdk/javascript/public_methods_embeddertest.cpp
+++ b/fpdfsdk/javascript/public_methods_embeddertest.cpp
@@ -103,7 +103,7 @@ TEST_F(PublicMethodsEmbedderTest, MakeFormatDate) {
v8::Isolate::Scope isolate_scope(isolate());
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
- CFX_WideString formatted_date;
+ WideString formatted_date;
// 1968-06-25
formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"ddmmyy");
diff --git a/fpdfsdk/javascript/report.cpp b/fpdfsdk/javascript/report.cpp
index c9c986d195..45509437a3 100644
--- a/fpdfsdk/javascript/report.cpp
+++ b/fpdfsdk/javascript/report.cpp
@@ -29,7 +29,7 @@ Report::~Report() {}
bool Report::writeText(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
@@ -37,7 +37,7 @@ bool Report::writeText(CJS_Runtime* pRuntime,
bool Report::save(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
// Unsafe, not supported.
return true;
}
diff --git a/fpdfsdk/javascript/report.h b/fpdfsdk/javascript/report.h
index c66db80fd1..0f040c6c4e 100644
--- a/fpdfsdk/javascript/report.h
+++ b/fpdfsdk/javascript/report.h
@@ -20,11 +20,11 @@ class Report : public CJS_EmbedObj {
bool save(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool writeText(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
};
class CJS_Report : public CJS_Object {
diff --git a/fpdfsdk/javascript/resource.cpp b/fpdfsdk/javascript/resource.cpp
index 6113c54338..8ca5b2a3b7 100644
--- a/fpdfsdk/javascript/resource.cpp
+++ b/fpdfsdk/javascript/resource.cpp
@@ -6,7 +6,7 @@
#include "fpdfsdk/javascript/resource.h"
-CFX_WideString JSGetStringFromID(uint32_t id) {
+WideString JSGetStringFromID(uint32_t id) {
switch (id) {
case IDS_STRING_JSALERT:
return L"Alert";
@@ -54,13 +54,13 @@ CFX_WideString JSGetStringFromID(uint32_t id) {
}
}
-CFX_WideString JSFormatErrorString(const char* class_name,
- const char* property_name,
- const CFX_WideString& details) {
- CFX_WideString result = CFX_WideString::FromLocal(class_name);
+WideString JSFormatErrorString(const char* class_name,
+ const char* property_name,
+ const WideString& details) {
+ WideString result = WideString::FromLocal(class_name);
if (property_name) {
result += L".";
- result += CFX_WideString::FromLocal(property_name);
+ result += WideString::FromLocal(property_name);
}
result += L": ";
result += details;
diff --git a/fpdfsdk/javascript/resource.h b/fpdfsdk/javascript/resource.h
index af7788ff7d..3891918259 100644
--- a/fpdfsdk/javascript/resource.h
+++ b/fpdfsdk/javascript/resource.h
@@ -32,9 +32,9 @@ class CJS_EventContext;
#define IDS_STRING_JSNOPERMISSION 25639
#define IDS_STRING_JSBADOBJECT 25640
-CFX_WideString JSGetStringFromID(uint32_t id);
-CFX_WideString JSFormatErrorString(const char* class_name,
- const char* property_name,
- const CFX_WideString& details);
+WideString JSGetStringFromID(uint32_t id);
+WideString JSFormatErrorString(const char* class_name,
+ const char* property_name,
+ const WideString& details);
#endif // FPDFSDK_JAVASCRIPT_RESOURCE_H_
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index e00f9e1560..04f1eb36cd 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -76,7 +76,7 @@ util::~util() {}
bool util::printf(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
const size_t iSize = params.size();
if (iSize < 1)
return false;
@@ -111,7 +111,7 @@ bool util::printf(CJS_Runtime* pRuntime,
continue;
}
- CFX_WideString strSegment;
+ WideString strSegment;
switch (ParseDataType(&c_strFormat)) {
case UTIL_INT:
strSegment.Format(c_strFormat.c_str(), params[iIndex].ToInt(pRuntime));
@@ -139,7 +139,7 @@ bool util::printf(CJS_Runtime* pRuntime,
bool util::printd(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
const size_t iSize = params.size();
if (iSize < 2)
return false;
@@ -158,7 +158,7 @@ bool util::printd(CJS_Runtime* pRuntime,
}
if (p1.GetType() == CJS_Value::VT_number) {
- CFX_WideString swResult;
+ WideString swResult;
switch (p1.ToInt(pRuntime)) {
case 0:
swResult.Format(L"D:%04d%02d%02d%02d%02d%02d", jsDate.GetYear(pRuntime),
@@ -231,7 +231,7 @@ bool util::printd(CJS_Runtime* pRuntime,
};
for (size_t i = 0; i < FX_ArraySize(cTableAd); ++i) {
- CFX_WideString sValue;
+ WideString sValue;
sValue.Format(L"%d", cTableAd[i].iValue);
int iStart = 0;
@@ -271,7 +271,7 @@ bool util::printd(CJS_Runtime* pRuntime,
bool util::printx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -294,9 +294,9 @@ static wchar_t TranslateCase(wchar_t input, CaseMode eMode) {
return input;
}
-CFX_WideString util::printx(const CFX_WideString& wsFormat,
- const CFX_WideString& wsSource) {
- CFX_WideString wsResult;
+WideString util::printx(const WideString& wsFormat,
+ const WideString& wsSource) {
+ WideString wsResult;
FX_STRSIZE iSourceIdx = 0;
FX_STRSIZE iFormatIdx = 0;
CaseMode eCaseMode = kPreserveCase;
@@ -385,12 +385,12 @@ CFX_WideString util::printx(const CFX_WideString& wsFormat,
bool util::scand(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 2)
return false;
- CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
- CFX_WideString sDate = params[1].ToCFXWideString(pRuntime);
+ WideString sFormat = params[0].ToCFXWideString(pRuntime);
+ WideString sDate = params[1].ToCFXWideString(pRuntime);
double dDate = JS_GetDateTime();
if (sDate.GetLength() > 0) {
dDate = CJS_PublicMethods::MakeRegularDate(sDate, sFormat, nullptr);
@@ -408,7 +408,7 @@ bool util::scand(CJS_Runtime* pRuntime,
bool util::byteToChar(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError) {
+ WideString& sError) {
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
return false;
@@ -420,7 +420,7 @@ bool util::byteToChar(CJS_Runtime* pRuntime,
return false;
}
- CFX_WideString wStr(static_cast<wchar_t>(arg));
+ WideString wStr(static_cast<wchar_t>(arg));
vRet = CJS_Value(pRuntime, wStr.c_str());
return true;
}
diff --git a/fpdfsdk/javascript/util.h b/fpdfsdk/javascript/util.h
index 60fa631dad..ba46e4f6c7 100644
--- a/fpdfsdk/javascript/util.h
+++ b/fpdfsdk/javascript/util.h
@@ -25,26 +25,26 @@ class util : public CJS_EmbedObj {
bool printd(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool printf(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool printx(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool scand(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
bool byteToChar(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
+ WideString& sError);
- static CFX_WideString printx(const CFX_WideString& cFormat,
- const CFX_WideString& cSource);
+ static WideString printx(const WideString& cFormat,
+ const WideString& cSource);
private:
friend class CJS_Util_ParseDataType_Test;
diff --git a/fpdfsdk/pdfsdk_fieldaction.h b/fpdfsdk/pdfsdk_fieldaction.h
index 4ee56ac3f6..aec5dcaa27 100644
--- a/fpdfsdk/pdfsdk_fieldaction.h
+++ b/fpdfsdk/pdfsdk_fieldaction.h
@@ -25,12 +25,12 @@ struct PDFSDK_FieldAction {
bool bModifier;
bool bShift;
int nCommitKey;
- CFX_WideString sChange;
- CFX_WideString sChangeEx;
+ WideString sChange;
+ WideString sChangeEx;
bool bKeyDown;
int nSelEnd;
int nSelStart;
- CFX_WideString sValue;
+ WideString sValue;
bool bWillCommit;
bool bFieldFull;
bool bRC;
diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp
index c7188ada07..6a19efb906 100644
--- a/fpdfsdk/pwl/cpwl_appstream.cpp
+++ b/fpdfsdk/pwl/cpwl_appstream.cpp
@@ -79,8 +79,8 @@ const char kTextEndOperator[] = "ET";
class AutoClosedCommand {
public:
AutoClosedCommand(std::ostringstream* stream,
- CFX_ByteString open,
- CFX_ByteString close)
+ ByteString open,
+ ByteString close)
: stream_(stream), close_(close) {
*stream_ << open << "\n";
}
@@ -89,7 +89,7 @@ class AutoClosedCommand {
private:
std::ostringstream* stream_;
- CFX_ByteString close_;
+ ByteString close_;
};
class AutoClosedQCommand : public AutoClosedCommand {
@@ -99,8 +99,8 @@ class AutoClosedQCommand : public AutoClosedCommand {
~AutoClosedQCommand() override {}
};
-CFX_ByteString GetColorAppStream(const CFX_Color& color,
- const bool& bFillOrStroke) {
+ByteString GetColorAppStream(const CFX_Color& color,
+ const bool& bFillOrStroke) {
std::ostringstream sColorStream;
switch (color.nColorType) {
@@ -125,10 +125,10 @@ CFX_ByteString GetColorAppStream(const CFX_Color& color,
break;
}
- return CFX_ByteString(sColorStream);
+ return ByteString(sColorStream);
}
-CFX_ByteString GetAP_Check(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Check(const CFX_FloatRect& crBBox) {
const float fWidth = crBBox.right - crBBox.left;
const float fHeight = crBBox.top - crBBox.bottom;
@@ -174,10 +174,10 @@ CFX_ByteString GetAP_Check(const CFX_FloatRect& crBBox) {
<< pts[nNext][0].y << " " << kCurveToOperator << "\n";
}
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Circle(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Circle(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
float fWidth = crBBox.right - crBBox.left;
@@ -218,10 +218,10 @@ CFX_ByteString GetAP_Circle(const CFX_FloatRect& crBBox) {
<< pt1.y - py * FX_BEZIER << " " << pt1.x << " " << pt1.y << " "
<< kCurveToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Cross(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Cross(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
csAP << crBBox.left << " " << crBBox.top << " " << kMoveToOperator << "\n";
@@ -230,10 +230,10 @@ CFX_ByteString GetAP_Cross(const CFX_FloatRect& crBBox) {
csAP << crBBox.left << " " << crBBox.bottom << " " << kMoveToOperator << "\n";
csAP << crBBox.right << " " << crBBox.top << " " << kLineToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
float fWidth = crBBox.right - crBBox.left;
@@ -250,10 +250,10 @@ CFX_ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) {
csAP << pt4.x << " " << pt4.y << " " << kLineToOperator << "\n";
csAP << pt1.x << " " << pt1.y << " " << kLineToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Square(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Square(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
csAP << crBBox.left << " " << crBBox.top << " " << kMoveToOperator << "\n";
@@ -263,10 +263,10 @@ CFX_ByteString GetAP_Square(const CFX_FloatRect& crBBox) {
csAP << crBBox.left << " " << crBBox.bottom << " " << kLineToOperator << "\n";
csAP << crBBox.left << " " << crBBox.top << " " << kLineToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_Star(const CFX_FloatRect& crBBox) {
+ByteString GetAP_Star(const CFX_FloatRect& crBBox) {
std::ostringstream csAP;
float fRadius = (crBBox.top - crBBox.bottom) / (1 + (float)cos(FX_PI / 5.0f));
@@ -292,10 +292,10 @@ CFX_ByteString GetAP_Star(const CFX_FloatRect& crBBox) {
csAP << px[nNext] << " " << py[nNext] << " " << kLineToOperator << "\n";
}
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) {
+ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) {
std::ostringstream csAP;
float fWidth = crBBox.right - crBBox.left;
@@ -328,44 +328,44 @@ CFX_ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) {
<< pt3.y + py * FX_BEZIER << " " << pt3.x << " " << pt3.y << " "
<< kCurveToOperator << "\n";
- return CFX_ByteString(csAP);
+ return ByteString(csAP);
}
-CFX_ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, true) << GetAP_Check(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, true) << GetAP_Circle(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Cross(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Cross(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, false) << GetAP_Cross(rcBBox)
<< kStrokeOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
@@ -373,51 +373,51 @@ CFX_ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
<< GetColorAppStream(crText, true) << GetAP_Diamond(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Square(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Square(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, true) << GetAP_Square(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetAppStream_Star(const CFX_FloatRect& rcBBox,
- const CFX_Color& crText) {
+ByteString GetAppStream_Star(const CFX_FloatRect& rcBBox,
+ const CFX_Color& crText) {
std::ostringstream sAP;
{
AutoClosedQCommand q(&sAP);
sAP << GetColorAppStream(crText, true) << GetAP_Star(rcBBox)
<< kFillOperator << "\n";
}
- return CFX_ByteString(sAP);
+ return ByteString(sAP);
}
-CFX_ByteString GetCircleFillAppStream(const CFX_FloatRect& rect,
- const CFX_Color& color) {
+ByteString GetCircleFillAppStream(const CFX_FloatRect& rect,
+ const CFX_Color& color) {
std::ostringstream sAppStream;
- CFX_ByteString sColor = GetColorAppStream(color, true);
+ ByteString sColor = GetColorAppStream(color, true);
if (sColor.GetLength() > 0) {
AutoClosedQCommand q(&sAppStream);
sAppStream << sColor << GetAP_Circle(rect) << kFillOperator << "\n";
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect,
- float fWidth,
- const CFX_Color& color,
- const CFX_Color& crLeftTop,
- const CFX_Color& crRightBottom,
- BorderStyle nStyle,
- const CPWL_Dash& dash) {
+ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect,
+ float fWidth,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
+ BorderStyle nStyle,
+ const CPWL_Dash& dash) {
std::ostringstream sAppStream;
- CFX_ByteString sColor;
+ ByteString sColor;
if (fWidth > 0.0f) {
AutoClosedQCommand q(&sAppStream);
@@ -502,12 +502,12 @@ CFX_ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect,
} break;
}
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
- CheckStyle nStyle,
- const CFX_Color& crText) {
+ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
+ CheckStyle nStyle,
+ const CFX_Color& crText) {
CFX_FloatRect rcCenter = rcBBox.GetCenterSquare();
switch (nStyle) {
default:
@@ -530,9 +530,9 @@ CFX_ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
}
}
-CFX_ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
- CheckStyle nStyle,
- const CFX_Color& crText) {
+ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
+ CheckStyle nStyle,
+ const CFX_Color& crText) {
CFX_FloatRect rcCenter = rcBBox.GetCenterSquare();
switch (nStyle) {
default:
@@ -555,33 +555,33 @@ CFX_ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
}
}
-CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap,
- int32_t nFontIndex,
- float fFontSize) {
+ByteString GetFontSetString(IPVT_FontMap* pFontMap,
+ int32_t nFontIndex,
+ float fFontSize) {
if (!pFontMap)
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
+ ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
if (sFontAlias.GetLength() <= 0 || fFontSize <= 0)
- return CFX_ByteString();
+ return ByteString();
std::ostringstream sRet;
sRet << "/" << sFontAlias << " " << fFontSize << " "
<< kSetTextFontAndSizeOperator << "\n";
- return CFX_ByteString(sRet);
+ return ByteString(sRet);
}
-CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) {
+ByteString GetWordRenderString(const ByteString& strWords) {
if (strWords.GetLength() > 0) {
return PDF_EncodeString(strWords, false) + " " + kShowTextOperator + "\n";
}
- return CFX_ByteString();
+ return ByteString();
}
-CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit,
- const CFX_PointF& ptOffset,
- bool bContinuous,
- uint16_t SubWord) {
+ByteString GetEditAppStream(CPWL_EditImpl* pEdit,
+ const CFX_PointF& ptOffset,
+ bool bContinuous,
+ uint16_t SubWord) {
CPWL_EditImpl_Iterator* pIterator = pEdit->GetIterator();
pIterator->SetAt(0);
@@ -597,7 +597,7 @@ CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit,
if (bContinuous) {
if (place.LineCmp(oldplace) != 0) {
if (sWords.tellp() > 0) {
- sEditStream << GetWordRenderString(CFX_ByteString(sWords));
+ sEditStream << GetWordRenderString(ByteString(sWords));
sWords.str("");
}
@@ -624,7 +624,7 @@ CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit,
if (pIterator->GetWord(word)) {
if (word.nFontIndex != nCurFontIndex) {
if (sWords.tellp() > 0) {
- sEditStream << GetWordRenderString(CFX_ByteString(sWords));
+ sEditStream << GetWordRenderString(ByteString(sWords));
sWords.str("");
}
sEditStream << GetFontSetString(pEdit->GetFontMap(), word.nFontIndex,
@@ -661,7 +661,7 @@ CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit,
}
if (sWords.tellp() > 0) {
- sEditStream << GetWordRenderString(CFX_ByteString(sWords));
+ sEditStream << GetWordRenderString(ByteString(sWords));
sWords.str("");
}
@@ -681,14 +681,14 @@ CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit,
sAppStream << sEditStream.str();
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GenerateIconAppStream(CPDF_IconFit& fit,
- CPDF_Stream* pIconStream,
- const CFX_FloatRect& rcIcon) {
+ByteString GenerateIconAppStream(CPDF_IconFit& fit,
+ CPDF_Stream* pIconStream,
+ const CFX_FloatRect& rcIcon) {
if (rcIcon.IsEmpty() || !pIconStream)
- return CFX_ByteString();
+ return ByteString();
CPWL_Icon icon;
CPWL_Wnd::CreateParams cp;
@@ -698,9 +698,9 @@ CFX_ByteString GenerateIconAppStream(CPDF_IconFit& fit,
icon.SetPDFStream(pIconStream);
icon.Move(rcIcon, false, false);
- CFX_ByteString sAlias = icon.GetImageAlias();
+ ByteString sAlias = icon.GetImageAlias();
if (sAlias.GetLength() <= 0)
- return CFX_ByteString();
+ return ByteString();
CFX_FloatRect rcPlate = icon.GetClientRect();
CFX_Matrix mt = icon.GetImageMatrix().GetInverse();
@@ -732,17 +732,17 @@ CFX_ByteString GenerateIconAppStream(CPDF_IconFit& fit,
}
icon.Destroy();
- return CFX_ByteString(str);
+ return ByteString(str);
}
-CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
- IPVT_FontMap* pFontMap,
- CPDF_Stream* pIconStream,
- CPDF_IconFit& IconFit,
- const CFX_WideString& sLabel,
- const CFX_Color& crText,
- float fFontSize,
- ButtonStyle nLayOut) {
+ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
+ IPVT_FontMap* pFontMap,
+ CPDF_Stream* pIconStream,
+ CPDF_IconFit& IconFit,
+ const WideString& sLabel,
+ const CFX_Color& crText,
+ float fFontSize,
+ ButtonStyle nLayOut) {
const float fAutoFontScale = 1.0f / 3.0f;
auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>();
@@ -902,7 +902,7 @@ CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
if (!rcLabel.IsEmpty()) {
pEdit->SetPlateRect(rcLabel);
- CFX_ByteString sEdit =
+ ByteString sEdit =
GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f), true, 0);
if (sEdit.GetLength() > 0) {
AutoClosedCommand bt(&sTemp, kTextBeginOperator, kTextEndOperator);
@@ -911,7 +911,7 @@ CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
}
if (sTemp.tellp() <= 0)
- return CFX_ByteString();
+ return ByteString();
std::ostringstream sAppStream;
{
@@ -923,18 +923,18 @@ CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
<< kEndPathNoFillOrStrokeOperator << "\n";
sAppStream << sTemp.str().c_str();
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetBorderAppStreamInternal(const CFX_FloatRect& rect,
- float fWidth,
- const CFX_Color& color,
- const CFX_Color& crLeftTop,
- const CFX_Color& crRightBottom,
- BorderStyle nStyle,
- const CPWL_Dash& dash) {
+ByteString GetBorderAppStreamInternal(const CFX_FloatRect& rect,
+ float fWidth,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
+ BorderStyle nStyle,
+ const CPWL_Dash& dash) {
std::ostringstream sAppStream;
- CFX_ByteString sColor;
+ ByteString sColor;
float fLeft = rect.left;
float fRight = rect.right;
@@ -1044,12 +1044,12 @@ CFX_ByteString GetBorderAppStreamInternal(const CFX_FloatRect& rect,
}
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
+ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
if (rcBBox.IsEmpty())
- return CFX_ByteString();
+ return ByteString();
std::ostringstream sAppStream;
{
@@ -1087,13 +1087,13 @@ CFX_ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
<< kLineToOperator << " " << kFillOperator << "\n";
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
-CFX_ByteString GetRectFillAppStream(const CFX_FloatRect& rect,
- const CFX_Color& color) {
+ByteString GetRectFillAppStream(const CFX_FloatRect& rect,
+ const CFX_Color& color) {
std::ostringstream sAppStream;
- CFX_ByteString sColor = GetColorAppStream(color, true);
+ ByteString sColor = GetColorAppStream(color, true);
if (sColor.GetLength() > 0) {
AutoClosedQCommand q(&sAppStream);
sAppStream << sColor << rect.left << " " << rect.bottom << " "
@@ -1101,7 +1101,7 @@ CFX_ByteString GetRectFillAppStream(const CFX_FloatRect& rect,
<< kAppendRectOperator << " " << kFillOperator << "\n";
}
- return CFX_ByteString(sAppStream);
+ return ByteString(sAppStream);
}
} // namespace
@@ -1177,7 +1177,7 @@ void CPWL_AppStream::SetAsPushButton() {
CFX_FloatRect rcClient = rcWindow.GetDeflated(fBorderWidth, fBorderWidth);
CFX_Color crText(COLORTYPE_GRAY, 0);
- CFX_ByteString csNameTag;
+ ByteString csNameTag;
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
@@ -1187,10 +1187,10 @@ void CPWL_AppStream::SetAsPushButton() {
if (da.HasFont())
csNameTag = da.GetFont(&fFontSize);
- CFX_WideString csWCaption;
- CFX_WideString csNormalCaption;
- CFX_WideString csRolloverCaption;
- CFX_WideString csDownCaption;
+ WideString csWCaption;
+ WideString csNormalCaption;
+ WideString csRolloverCaption;
+ WideString csDownCaption;
if (pControl->HasMKEntry("CA"))
csNormalCaption = pControl->GetNormalCaption();
@@ -1240,7 +1240,7 @@ void CPWL_AppStream::SetAsPushButton() {
widget_->GetInterForm()->GetFormFillEnv()->GetSysHandler());
font_map.SetAPType("N");
- CFX_ByteString csAP =
+ ByteString csAP =
GetRectFillAppStream(rcWindow, crBackground) +
GetBorderAppStreamInternal(rcWindow, fBorderWidth, crBorder, crLeftTop,
crRightBottom, nBorderStyle, dsBorder) +
@@ -1359,7 +1359,7 @@ void CPWL_AppStream::SetAsCheckBox() {
}
CheckStyle nStyle = CheckStyle::kCheck;
- CFX_WideString csWCaption = pControl->GetNormalCaption();
+ WideString csWCaption = pControl->GetNormalCaption();
if (csWCaption.GetLength() > 0) {
switch (csWCaption[0]) {
case L'l':
@@ -1383,12 +1383,12 @@ void CPWL_AppStream::SetAsCheckBox() {
}
}
- CFX_ByteString csAP_N_ON =
+ ByteString csAP_N_ON =
GetRectFillAppStream(rcWindow, crBackground) +
GetBorderAppStreamInternal(rcWindow, fBorderWidth, crBorder, crLeftTop,
crRightBottom, nBorderStyle, dsBorder);
- CFX_ByteString csAP_N_OFF = csAP_N_ON;
+ ByteString csAP_N_OFF = csAP_N_ON;
switch (nBorderStyle) {
case BorderStyle::BEVELED: {
@@ -1406,12 +1406,12 @@ void CPWL_AppStream::SetAsCheckBox() {
break;
}
- CFX_ByteString csAP_D_ON =
+ ByteString csAP_D_ON =
GetRectFillAppStream(rcWindow, crBackground - 0.25f) +
GetBorderAppStreamInternal(rcWindow, fBorderWidth, crBorder, crLeftTop,
crRightBottom, nBorderStyle, dsBorder);
- CFX_ByteString csAP_D_OFF = csAP_D_ON;
+ ByteString csAP_D_OFF = csAP_D_ON;
csAP_N_ON += GetCheckBoxAppStream(rcClient, nStyle, crText);
csAP_D_ON += GetCheckBoxAppStream(rcClient, nStyle, crText);
@@ -1422,7 +1422,7 @@ void CPWL_AppStream::SetAsCheckBox() {
Write("D", csAP_D_ON, pControl->GetCheckedAPState());
Write("D", csAP_D_OFF, "Off");
- CFX_ByteString csAS = widget_->GetAppState();
+ ByteString csAS = widget_->GetAppState();
if (csAS.IsEmpty())
widget_->SetAppState("Off");
}
@@ -1475,7 +1475,7 @@ void CPWL_AppStream::SetAsRadioButton() {
}
CheckStyle nStyle = CheckStyle::kCircle;
- CFX_WideString csWCaption = pControl->GetNormalCaption();
+ WideString csWCaption = pControl->GetNormalCaption();
if (csWCaption.GetLength() > 0) {
switch (csWCaption[0]) {
case L'8':
@@ -1499,7 +1499,7 @@ void CPWL_AppStream::SetAsRadioButton() {
}
}
- CFX_ByteString csAP_N_ON;
+ ByteString csAP_N_ON;
CFX_FloatRect rcCenter = rcWindow.GetCenterSquare().GetDeflated(1.0f, 1.0f);
if (nStyle == CheckStyle::kCircle) {
if (nBorderStyle == BorderStyle::BEVELED) {
@@ -1521,7 +1521,7 @@ void CPWL_AppStream::SetAsRadioButton() {
crRightBottom, nBorderStyle, dsBorder);
}
- CFX_ByteString csAP_N_OFF = csAP_N_ON;
+ ByteString csAP_N_OFF = csAP_N_ON;
switch (nBorderStyle) {
case BorderStyle::BEVELED: {
@@ -1539,7 +1539,7 @@ void CPWL_AppStream::SetAsRadioButton() {
break;
}
- CFX_ByteString csAP_D_ON;
+ ByteString csAP_D_ON;
if (nStyle == CheckStyle::kCircle) {
CFX_Color crBK = crBackground - 0.25f;
@@ -1563,7 +1563,7 @@ void CPWL_AppStream::SetAsRadioButton() {
crRightBottom, nBorderStyle, dsBorder);
}
- CFX_ByteString csAP_D_OFF = csAP_D_ON;
+ ByteString csAP_D_OFF = csAP_D_ON;
csAP_N_ON += GetRadioButtonAppStream(rcClient, nStyle, crText);
csAP_D_ON += GetRadioButtonAppStream(rcClient, nStyle, crText);
@@ -1574,12 +1574,12 @@ void CPWL_AppStream::SetAsRadioButton() {
Write("D", csAP_D_ON, pControl->GetCheckedAPState());
Write("D", csAP_D_OFF, "Off");
- CFX_ByteString csAS = widget_->GetAppState();
+ ByteString csAS = widget_->GetAppState();
if (csAS.IsEmpty())
widget_->SetAppState("Off");
}
-void CPWL_AppStream::SetAsComboBox(const CFX_WideString* sValue) {
+void CPWL_AppStream::SetAsComboBox(const WideString* sValue) {
CPDF_FormControl* pControl = widget_->GetFormControl();
CPDF_FormField* pField = pControl->GetField();
std::ostringstream sBody;
@@ -1623,7 +1623,7 @@ void CPWL_AppStream::SetAsComboBox(const CFX_WideString* sValue) {
}
CFX_FloatRect rcContent = pEdit->GetContentRect();
- CFX_ByteString sEdit = GetEditAppStream(pEdit.get(), CFX_PointF(), true, 0);
+ ByteString sEdit = GetEditAppStream(pEdit.get(), CFX_PointF(), true, 0);
if (sEdit.GetLength() > 0) {
sBody << "/Tx ";
AutoClosedCommand bmc(&sBody, kMarkedSequenceBeginOperator,
@@ -1645,7 +1645,7 @@ void CPWL_AppStream::SetAsComboBox(const CFX_WideString* sValue) {
sBody << GetDropButtonAppStream(rcButton);
Write("N",
- GetBackgroundAppStream() + GetBorderAppStream() + CFX_ByteString(sBody),
+ GetBackgroundAppStream() + GetBorderAppStream() + ByteString(sBody),
"");
}
@@ -1729,11 +1729,11 @@ void CPWL_AppStream::SetAsListBox() {
<< sList.str();
}
Write("N",
- GetBackgroundAppStream() + GetBorderAppStream() + CFX_ByteString(sBody),
+ GetBackgroundAppStream() + GetBorderAppStream() + ByteString(sBody),
"");
}
-void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) {
+void CPWL_AppStream::SetAsTextField(const WideString* sValue) {
CPDF_FormControl* pControl = widget_->GetFormControl();
CPDF_FormField* pField = pControl->GetField();
std::ostringstream sBody;
@@ -1771,7 +1771,7 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) {
float fFontSize = widget_->GetFontSize();
#ifdef PDF_ENABLE_XFA
- CFX_WideString sValueTmp;
+ WideString sValueTmp;
if (!sValue && widget_->GetMixXFAWidget()) {
sValueTmp = widget_->GetValue(true);
sValue = &sValueTmp;
@@ -1802,7 +1802,7 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) {
pEdit->SetText(sValue ? *sValue : pField->GetValue());
CFX_FloatRect rcContent = pEdit->GetContentRect();
- CFX_ByteString sEdit =
+ ByteString sEdit =
GetEditAppStream(pEdit.get(), CFX_PointF(), !bCharArray, subWord);
if (sEdit.GetLength() > 0) {
@@ -1828,7 +1828,7 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) {
if (bCharArray) {
switch (widget_->GetBorderStyle()) {
case BorderStyle::SOLID: {
- CFX_ByteString sColor =
+ ByteString sColor =
GetColorAppStream(widget_->GetBorderPWLColor(), false);
if (sColor.GetLength() > 0) {
AutoClosedQCommand q(&sLines);
@@ -1851,7 +1851,7 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) {
break;
}
case BorderStyle::DASH: {
- CFX_ByteString sColor =
+ ByteString sColor =
GetColorAppStream(widget_->GetBorderPWLColor(), false);
if (sColor.GetLength() > 0) {
CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0);
@@ -1880,16 +1880,15 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) {
}
Write("N",
- GetBackgroundAppStream() + GetBorderAppStream() +
- CFX_ByteString(sLines) + CFX_ByteString(sBody),
+ GetBackgroundAppStream() + GetBorderAppStream() + ByteString(sLines) +
+ ByteString(sBody),
"");
}
-void CPWL_AppStream::AddImage(const CFX_ByteString& sAPType,
- CPDF_Stream* pImage) {
+void CPWL_AppStream::AddImage(const ByteString& sAPType, CPDF_Stream* pImage) {
CPDF_Stream* pStream = dict_->GetStreamFor(sAPType);
CPDF_Dictionary* pStreamDict = pStream->GetDict();
- CFX_ByteString sImageAlias = "IMG";
+ ByteString sImageAlias = "IMG";
if (CPDF_Dictionary* pImageDict = pImage->GetDict()) {
sImageAlias = pImageDict->GetStringFor("Name");
@@ -1908,9 +1907,9 @@ void CPWL_AppStream::AddImage(const CFX_ByteString& sAPType,
pImage->GetObjNum());
}
-void CPWL_AppStream::Write(const CFX_ByteString& sAPType,
- const CFX_ByteString& sContents,
- const CFX_ByteString& sAPState) {
+void CPWL_AppStream::Write(const ByteString& sAPType,
+ const ByteString& sContents,
+ const ByteString& sAPState) {
CPDF_Stream* pStream = nullptr;
CPDF_Dictionary* pParentDict = nullptr;
if (sAPState.IsEmpty()) {
@@ -1947,19 +1946,19 @@ void CPWL_AppStream::Write(const CFX_ByteString& sAPType,
sContents.GetLength());
}
-void CPWL_AppStream::Remove(const CFX_ByteString& sAPType) {
+void CPWL_AppStream::Remove(const ByteString& sAPType) {
dict_->RemoveFor(sAPType);
}
-CFX_ByteString CPWL_AppStream::GetBackgroundAppStream() const {
+ByteString CPWL_AppStream::GetBackgroundAppStream() const {
CFX_Color crBackground = widget_->GetFillPWLColor();
if (crBackground.nColorType != COLORTYPE_TRANSPARENT)
return GetRectFillAppStream(widget_->GetRotatedRect(), crBackground);
- return CFX_ByteString();
+ return ByteString();
}
-CFX_ByteString CPWL_AppStream::GetBorderAppStream() const {
+ByteString CPWL_AppStream::GetBorderAppStream() const {
CFX_FloatRect rcWindow = widget_->GetRotatedRect();
CFX_Color crBorder = widget_->GetBorderPWLColor();
CFX_Color crBackground = widget_->GetFillPWLColor();
diff --git a/fpdfsdk/pwl/cpwl_appstream.h b/fpdfsdk/pwl/cpwl_appstream.h
index 2043c7b0d7..d73e3aa0a7 100644
--- a/fpdfsdk/pwl/cpwl_appstream.h
+++ b/fpdfsdk/pwl/cpwl_appstream.h
@@ -22,19 +22,19 @@ class CPWL_AppStream {
void SetAsPushButton();
void SetAsCheckBox();
void SetAsRadioButton();
- void SetAsComboBox(const CFX_WideString* sValue);
+ void SetAsComboBox(const WideString* sValue);
void SetAsListBox();
- void SetAsTextField(const CFX_WideString* sValue);
+ void SetAsTextField(const WideString* sValue);
private:
- void AddImage(const CFX_ByteString& sAPType, CPDF_Stream* pImage);
- void Write(const CFX_ByteString& sAPType,
- const CFX_ByteString& sContents,
- const CFX_ByteString& sAPState);
- void Remove(const CFX_ByteString& sAPType);
-
- CFX_ByteString GetBackgroundAppStream() const;
- CFX_ByteString GetBorderAppStream() const;
+ void AddImage(const ByteString& sAPType, CPDF_Stream* pImage);
+ void Write(const ByteString& sAPType,
+ const ByteString& sContents,
+ const ByteString& sAPState);
+ void Remove(const ByteString& sAPType);
+
+ ByteString GetBackgroundAppStream() const;
+ ByteString GetBorderAppStream() const;
CFX_UnownedPtr<CPDFSDK_Widget> widget_;
CFX_UnownedPtr<CPDF_Dictionary> dict_;
diff --git a/fpdfsdk/pwl/cpwl_button.cpp b/fpdfsdk/pwl/cpwl_button.cpp
index fc0479be2c..5c06a98fa6 100644
--- a/fpdfsdk/pwl/cpwl_button.cpp
+++ b/fpdfsdk/pwl/cpwl_button.cpp
@@ -11,7 +11,7 @@ CPWL_Button::CPWL_Button() : m_bMouseDown(false) {}
CPWL_Button::~CPWL_Button() {}
-CFX_ByteString CPWL_Button::GetClassName() const {
+ByteString CPWL_Button::GetClassName() const {
return "CPWL_Button";
}
diff --git a/fpdfsdk/pwl/cpwl_button.h b/fpdfsdk/pwl/cpwl_button.h
index f26ae1c1f3..70f5ef1908 100644
--- a/fpdfsdk/pwl/cpwl_button.h
+++ b/fpdfsdk/pwl/cpwl_button.h
@@ -15,7 +15,7 @@ class CPWL_Button : public CPWL_Wnd {
~CPWL_Button() override;
// CPWL_Wnd
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreate(CreateParams* pParamsToAdjust) override;
bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override;
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
diff --git a/fpdfsdk/pwl/cpwl_caret.cpp b/fpdfsdk/pwl/cpwl_caret.cpp
index 3d05961601..b1040bc2e3 100644
--- a/fpdfsdk/pwl/cpwl_caret.cpp
+++ b/fpdfsdk/pwl/cpwl_caret.cpp
@@ -19,7 +19,7 @@ CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {}
CPWL_Caret::~CPWL_Caret() {}
-CFX_ByteString CPWL_Caret::GetClassName() const {
+ByteString CPWL_Caret::GetClassName() const {
return "CPWL_Caret";
}
diff --git a/fpdfsdk/pwl/cpwl_caret.h b/fpdfsdk/pwl/cpwl_caret.h
index 32034708a7..fb0fa8978c 100644
--- a/fpdfsdk/pwl/cpwl_caret.h
+++ b/fpdfsdk/pwl/cpwl_caret.h
@@ -15,7 +15,7 @@ class CPWL_Caret : public CPWL_Wnd {
~CPWL_Caret() override;
// CPWL_Wnd
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) override;
void InvalidateRect(CFX_FloatRect* pRect) override;
diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp
index 03651949b2..5bb9124931 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.cpp
+++ b/fpdfsdk/pwl/cpwl_combo_box.cpp
@@ -147,7 +147,7 @@ CPWL_ComboBox::CPWL_ComboBox() {}
CPWL_ComboBox::~CPWL_ComboBox() {}
-CFX_ByteString CPWL_ComboBox::GetClassName() const {
+ByteString CPWL_ComboBox::GetClassName() const {
return "CPWL_ComboBox";
}
@@ -177,31 +177,31 @@ void CPWL_ComboBox::KillFocus() {
CPWL_Wnd::KillFocus();
}
-CFX_WideString CPWL_ComboBox::GetSelectedText() {
+WideString CPWL_ComboBox::GetSelectedText() {
if (m_pEdit)
return m_pEdit->GetSelectedText();
- return CFX_WideString();
+ return WideString();
}
-void CPWL_ComboBox::ReplaceSelection(const CFX_WideString& text) {
+void CPWL_ComboBox::ReplaceSelection(const WideString& text) {
if (m_pEdit)
m_pEdit->ReplaceSelection(text);
}
-CFX_WideString CPWL_ComboBox::GetText() const {
+WideString CPWL_ComboBox::GetText() const {
if (m_pEdit) {
return m_pEdit->GetText();
}
- return CFX_WideString();
+ return WideString();
}
-void CPWL_ComboBox::SetText(const CFX_WideString& text) {
+void CPWL_ComboBox::SetText(const WideString& text) {
if (m_pEdit)
m_pEdit->SetText(text);
}
-void CPWL_ComboBox::AddString(const CFX_WideString& str) {
+void CPWL_ComboBox::AddString(const WideString& str) {
if (m_pList)
m_pList->AddString(str);
}
diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h
index b431191452..c9fa2cda4b 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.h
+++ b/fpdfsdk/pwl/cpwl_combo_box.h
@@ -50,7 +50,7 @@ class CPWL_ComboBox : public CPWL_Wnd {
CPWL_Edit* GetEdit() const { return m_pEdit.Get(); }
// CPWL_Wnd:
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreate(CreateParams* pParamsToAdjust) override;
void OnDestroy() override;
bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override;
@@ -62,14 +62,14 @@ class CPWL_ComboBox : public CPWL_Wnd {
CFX_FloatRect GetFocusRect() const override;
void SetFocus() override;
void KillFocus() override;
- CFX_WideString GetSelectedText() override;
- void ReplaceSelection(const CFX_WideString& text) override;
+ WideString GetSelectedText() override;
+ void ReplaceSelection(const WideString& text) override;
void SetFillerNotify(IPWL_Filler_Notify* pNotify);
- CFX_WideString GetText() const;
- void SetText(const CFX_WideString& text);
- void AddString(const CFX_WideString& str);
+ WideString GetText() const;
+ void SetText(const WideString& text);
+ void AddString(const WideString& str);
int32_t GetSelect() const;
void SetSelect(int32_t nItemIndex);
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index 8fbafd0ca0..c71dbe4be0 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -35,18 +35,18 @@ CPWL_Edit::~CPWL_Edit() {
ASSERT(!m_bFocus);
}
-CFX_ByteString CPWL_Edit::GetClassName() const {
+ByteString CPWL_Edit::GetClassName() const {
return PWL_CLASSNAME_EDIT;
}
-void CPWL_Edit::SetText(const CFX_WideString& csText) {
- CFX_WideString swText = csText;
+void CPWL_Edit::SetText(const WideString& csText) {
+ WideString swText = csText;
if (!HasFlag(PES_RICH)) {
m_pEdit->SetText(swText);
return;
}
- CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText);
+ ByteString sValue = ByteString::FromUnicode(swText);
std::unique_ptr<CXML_Element> pXML(
CXML_Element::Parse(sValue.c_str(), sValue.GetLength()));
if (!pXML) {
@@ -62,7 +62,7 @@ void CPWL_Edit::SetText(const CFX_WideString& csText) {
if (!pSubElement || !pSubElement->GetTagName().EqualNoCase("p"))
continue;
- CFX_WideString swSection;
+ WideString swSection;
int nSubChild = pSubElement->CountChildren();
for (int32_t j = 0; j < nSubChild; j++) {
CXML_Content* pSubContent = ToContent(pSubElement->GetChild(j));
@@ -443,7 +443,7 @@ void CPWL_Edit::SetLimitChar(int32_t nLimitChar) {
m_pEdit->SetLimitChar(nLimitChar);
}
-void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) {
+void CPWL_Edit::ReplaceSel(const WideString& wsText) {
m_pEdit->ClearSelection();
m_pEdit->InsertText(wsText, FX_CHARSET_Default);
}
@@ -463,8 +463,8 @@ bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) {
if (nChar == FWL_VKEY_Delete) {
if (m_pFillerNotify) {
- CFX_WideString strChange;
- CFX_WideString strChangeEx;
+ WideString strChange;
+ WideString strChangeEx;
int nSelStart = 0;
int nSelEnd = 0;
@@ -532,7 +532,7 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) {
if (!IsCTRLpressed(nFlag)) {
if (m_pFillerNotify) {
- CFX_WideString swChange;
+ WideString swChange;
int nSelStart = 0;
int nSelEnd = 0;
@@ -550,7 +550,7 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) {
break;
}
- CFX_WideString strChangeEx;
+ WideString strChangeEx;
std::tie(bRC, bExit) = m_pFillerNotify->OnBeforeKeyStroke(
GetAttachedData(), swChange, strChangeEx, nSelStart, nSelEnd, true,
nFlag);
diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h
index 3e8de04b47..d61b94730e 100644
--- a/fpdfsdk/pwl/cpwl_edit.h
+++ b/fpdfsdk/pwl/cpwl_edit.h
@@ -27,8 +27,8 @@ class IPWL_Filler_Notify {
float* fPopupRet) = 0;
virtual std::pair<bool, bool> OnBeforeKeyStroke(
CPWL_Wnd::PrivateData* pAttached,
- CFX_WideString& strChange,
- const CFX_WideString& strChangeEx,
+ WideString& strChange,
+ const WideString& strChangeEx,
int nSelStart,
int nSelEnd,
bool bKeyDown,
@@ -47,7 +47,7 @@ class CPWL_Edit : public CPWL_EditCtrl {
~CPWL_Edit() override;
// CPWL_EditCtrl
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreated() override;
void RePosChildWnd() override;
CFX_FloatRect GetClientRect() const override;
@@ -80,8 +80,8 @@ class CPWL_Edit : public CPWL_EditCtrl {
void CutText();
- void SetText(const CFX_WideString& csText);
- void ReplaceSel(const CFX_WideString& csText);
+ void SetText(const WideString& csText);
+ void ReplaceSel(const WideString& csText);
bool IsTextFull() const;
diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
index 7baaaa8ca5..f0fc408771 100644
--- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
@@ -52,14 +52,14 @@ void CPWL_EditCtrl::SetCursor() {
}
}
-CFX_WideString CPWL_EditCtrl::GetSelectedText() {
+WideString CPWL_EditCtrl::GetSelectedText() {
if (m_pEdit)
return m_pEdit->GetSelectedText();
- return CFX_WideString();
+ return WideString();
}
-void CPWL_EditCtrl::ReplaceSelection(const CFX_WideString& text) {
+void CPWL_EditCtrl::ReplaceSelection(const WideString& text) {
if (!m_pEdit)
return;
@@ -338,7 +338,7 @@ void CPWL_EditCtrl::SetCaret(bool bVisible,
}
}
-CFX_WideString CPWL_EditCtrl::GetText() const {
+WideString CPWL_EditCtrl::GetText() const {
return m_pEdit->GetText();
}
diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.h b/fpdfsdk/pwl/cpwl_edit_ctrl.h
index eb4470f734..37ac320d8f 100644
--- a/fpdfsdk/pwl/cpwl_edit_ctrl.h
+++ b/fpdfsdk/pwl/cpwl_edit_ctrl.h
@@ -25,7 +25,7 @@ class CPWL_EditCtrl : public CPWL_Wnd {
CPWL_EditCtrl();
~CPWL_EditCtrl() override;
- CFX_WideString GetText() const;
+ WideString GetText() const;
void SetSelection(int32_t nStartChar, int32_t nEndChar);
void GetSelection(int32_t& nStartChar, int32_t& nEndChar) const;
void ClearSelection();
@@ -60,8 +60,8 @@ class CPWL_EditCtrl : public CPWL_Wnd {
void SetFontSize(float fFontSize) override;
float GetFontSize() const override;
void SetCursor() override;
- CFX_WideString GetSelectedText() override;
- void ReplaceSelection(const CFX_WideString& text) override;
+ WideString GetSelectedText() override;
+ void ReplaceSelection(const WideString& text) override;
void SetCaret(bool bVisible,
const CFX_PointF& ptHead,
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index c44301f212..c65199955b 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -43,7 +43,7 @@ void DrawTextString(CFX_RenderDevice* pDevice,
CPDF_Font* pFont,
float fFontSize,
const CFX_Matrix& mtUser2Device,
- const CFX_ByteString& str,
+ const ByteString& str,
FX_ARGB crTextFill,
int32_t nHorzScale) {
if (!pFont)
@@ -394,7 +394,7 @@ void CFXEU_Delete::Undo() {
CFXEU_Clear::CFXEU_Clear(CPWL_EditImpl* pEdit,
const CPVT_WordRange& wrSel,
- const CFX_WideString& swText)
+ const WideString& swText)
: m_pEdit(pEdit), m_wrSel(wrSel), m_swText(swText) {
ASSERT(m_pEdit);
}
@@ -417,7 +417,7 @@ void CFXEU_Clear::Undo() {
CFXEU_InsertText::CFXEU_InsertText(CPWL_EditImpl* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
- const CFX_WideString& swText,
+ const WideString& swText,
int32_t charset)
: m_pEdit(pEdit),
m_wpOld(wpOldPlace),
@@ -526,7 +526,7 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice,
DrawTextString(
pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device,
- CFX_ByteString(sTextBuf), crOldFill, nHorzScale);
+ ByteString(sTextBuf), crOldFill, nHorzScale);
sTextBuf.str("");
}
@@ -553,7 +553,7 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice,
DrawTextString(pDevice,
CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device,
- CFX_ByteString(sTextBuf), crOldFill, nHorzScale);
+ ByteString(sTextBuf), crOldFill, nHorzScale);
}
}
@@ -736,8 +736,8 @@ CPVT_WordPlace CPWL_EditImpl::GetCaretWordPlace() const {
return m_wpCaret;
}
-CFX_WideString CPWL_EditImpl::GetText() const {
- CFX_WideString swRet;
+WideString CPWL_EditImpl::GetText() const {
+ WideString swRet;
if (!m_pVT->IsValid())
return swRet;
@@ -757,8 +757,8 @@ CFX_WideString CPWL_EditImpl::GetText() const {
return swRet;
}
-CFX_WideString CPWL_EditImpl::GetRangeText(const CPVT_WordRange& range) const {
- CFX_WideString swRet;
+WideString CPWL_EditImpl::GetRangeText(const CPVT_WordRange& range) const {
+ WideString swRet;
if (!m_pVT->IsValid())
return swRet;
@@ -783,7 +783,7 @@ CFX_WideString CPWL_EditImpl::GetRangeText(const CPVT_WordRange& range) const {
return swRet;
}
-CFX_WideString CPWL_EditImpl::GetSelectedText() const {
+WideString CPWL_EditImpl::GetSelectedText() const {
return GetRangeText(m_SelState.ConvertToWordRange());
}
@@ -802,7 +802,7 @@ CPVT_WordRange CPWL_EditImpl::GetSelectWordRange() const {
return m_SelState.ConvertToWordRange();
}
-void CPWL_EditImpl::SetText(const CFX_WideString& sText) {
+void CPWL_EditImpl::SetText(const WideString& sText) {
Empty();
DoInsertText(CPVT_WordPlace(0, 0, -1), sText, FX_CHARSET_Default);
Paint();
@@ -828,7 +828,7 @@ bool CPWL_EditImpl::ClearSelection() {
return Clear(true, true);
}
-bool CPWL_EditImpl::InsertText(const CFX_WideString& sText, int32_t charset) {
+bool CPWL_EditImpl::InsertText(const WideString& sText, int32_t charset) {
return InsertText(sText, charset, true, true);
}
@@ -1702,7 +1702,7 @@ bool CPWL_EditImpl::Clear(bool bAddUndo, bool bPaint) {
return true;
}
-bool CPWL_EditImpl::InsertText(const CFX_WideString& sText,
+bool CPWL_EditImpl::InsertText(const WideString& sText,
int32_t charset,
bool bAddUndo,
bool bPaint) {
@@ -1836,7 +1836,7 @@ void CPWL_EditImpl::EnableUndo(bool bUndo) {
}
CPVT_WordPlace CPWL_EditImpl::DoInsertText(const CPVT_WordPlace& place,
- const CFX_WideString& sText,
+ const WideString& sText,
int32_t charset) {
CPVT_WordPlace wp = place;
@@ -1877,15 +1877,15 @@ void CPWL_EditImpl::AddEditUndoItem(
m_Undo.AddItem(std::move(pEditUndoItem));
}
-CFX_ByteString CPWL_EditImpl::GetPDFWordString(int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord) {
+ByteString CPWL_EditImpl::GetPDFWordString(int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord) {
IPVT_FontMap* pFontMap = GetFontMap();
CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex);
if (!pPDFFont)
- return CFX_ByteString();
+ return ByteString();
- CFX_ByteString sWord;
+ ByteString sWord;
if (SubWord > 0) {
Word = SubWord;
} else {
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h
index 177a0524f4..a63b22cd10 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.h
+++ b/fpdfsdk/pwl/cpwl_edit_impl.h
@@ -233,7 +233,7 @@ class CFXEU_Clear : public IFX_Edit_UndoItem {
public:
CFXEU_Clear(CPWL_EditImpl* pEdit,
const CPVT_WordRange& wrSel,
- const CFX_WideString& swText);
+ const WideString& swText);
~CFXEU_Clear() override;
// IFX_Edit_UndoItem:
@@ -244,7 +244,7 @@ class CFXEU_Clear : public IFX_Edit_UndoItem {
CFX_UnownedPtr<CPWL_EditImpl> m_pEdit;
CPVT_WordRange m_wrSel;
- CFX_WideString m_swText;
+ WideString m_swText;
};
class CFXEU_InsertText : public IFX_Edit_UndoItem {
@@ -252,7 +252,7 @@ class CFXEU_InsertText : public IFX_Edit_UndoItem {
CFXEU_InsertText(CPWL_EditImpl* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
- const CFX_WideString& swText,
+ const WideString& swText,
int32_t charset);
~CFXEU_InsertText() override;
@@ -265,7 +265,7 @@ class CFXEU_InsertText : public IFX_Edit_UndoItem {
CPVT_WordPlace m_wpOld;
CPVT_WordPlace m_wpNew;
- CFX_WideString m_swText;
+ WideString m_swText;
int32_t m_nCharset;
};
@@ -323,27 +323,27 @@ class CPWL_EditImpl {
void OnVK_RIGHT(bool bShift, bool bCtrl);
void OnVK_HOME(bool bShift, bool bCtrl);
void OnVK_END(bool bShift, bool bCtrl);
- void SetText(const CFX_WideString& sText);
+ void SetText(const WideString& sText);
bool InsertWord(uint16_t word, int32_t charset);
bool InsertReturn();
bool Backspace();
bool Delete();
bool ClearSelection();
- bool InsertText(const CFX_WideString& sText, int32_t charset);
+ bool InsertText(const WideString& sText, int32_t charset);
bool Redo();
bool Undo();
CPVT_WordPlace WordIndexToWordPlace(int32_t index) const;
CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const;
int32_t GetCaret() const;
CPVT_WordPlace GetCaretWordPlace() const;
- CFX_WideString GetSelectedText() const;
- CFX_WideString GetText() const;
+ WideString GetSelectedText() const;
+ WideString GetText() const;
float GetFontSize() const;
uint16_t GetPasswordChar() const;
CFX_PointF GetScrollPos() const;
int32_t GetCharArray() const;
CFX_FloatRect GetContentRect() const;
- CFX_WideString GetRangeText(const CPVT_WordRange& range) const;
+ WideString GetRangeText(const CPVT_WordRange& range) const;
int32_t GetHorzScale() const;
float GetCharSpace() const;
void SetSelection(int32_t nStartChar, int32_t nEndChar);
@@ -366,15 +366,15 @@ class CPWL_EditImpl {
bool Empty();
CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place,
- const CFX_WideString& sText,
+ const WideString& sText,
int32_t charset);
int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset);
int32_t GetTotalLines() const;
- CFX_ByteString GetPDFWordString(int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord);
+ ByteString GetPDFWordString(int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord);
private:
friend class CPWL_EditImpl_Iterator;
@@ -408,7 +408,7 @@ class CPWL_EditImpl {
bool Backspace(bool bAddUndo, bool bPaint);
bool Delete(bool bAddUndo, bool bPaint);
bool Clear(bool bAddUndo, bool bPaint);
- bool InsertText(const CFX_WideString& sText,
+ bool InsertText(const WideString& sText,
int32_t charset,
bool bAddUndo,
bool bPaint);
diff --git a/fpdfsdk/pwl/cpwl_font_map.cpp b/fpdfsdk/pwl/cpwl_font_map.cpp
index 862973541a..94d5fb8518 100644
--- a/fpdfsdk/pwl/cpwl_font_map.cpp
+++ b/fpdfsdk/pwl/cpwl_font_map.cpp
@@ -66,11 +66,11 @@ CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) {
return nullptr;
}
-CFX_ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
+ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
if (pdfium::IndexInBounds(m_Data, nFontIndex) && m_Data[nFontIndex])
return m_Data[nFontIndex]->sFontName;
- return CFX_ByteString();
+ return ByteString();
}
bool CPWL_FontMap::KnowWord(int32_t nFontIndex, uint16_t word) {
@@ -122,15 +122,15 @@ int32_t CPWL_FontMap::CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) {
return word < 0xFF ? word : -1;
}
-CFX_ByteString CPWL_FontMap::GetNativeFontName(int32_t nCharset) {
+ByteString CPWL_FontMap::GetNativeFontName(int32_t nCharset) {
for (const auto& pData : m_NativeFont) {
if (pData && pData->nCharset == nCharset)
return pData->sFontName;
}
- CFX_ByteString sNew = GetNativeFont(nCharset);
+ ByteString sNew = GetNativeFont(nCharset);
if (sNew.IsEmpty())
- return CFX_ByteString();
+ return ByteString();
auto pNewData = pdfium::MakeUnique<CPWL_FontMap_Native>();
pNewData->nCharset = nCharset;
@@ -148,7 +148,7 @@ void CPWL_FontMap::Initialize() {
GetFontIndex(kDefaultFontName, FX_CHARSET_ANSI, false);
}
-bool CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) {
+bool CPWL_FontMap::IsStandardFont(const ByteString& sFontName) {
for (size_t i = 0; i < FX_ArraySize(g_sDEStandardFontName); ++i) {
if (sFontName == g_sDEStandardFontName[i])
return true;
@@ -157,8 +157,7 @@ bool CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) {
return false;
}
-int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName,
- int32_t nCharset) {
+int32_t CPWL_FontMap::FindFont(const ByteString& sFontName, int32_t nCharset) {
int32_t i = 0;
for (const auto& pData : m_Data) {
if (pData &&
@@ -171,17 +170,17 @@ int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName,
return -1;
}
-int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName,
+int32_t CPWL_FontMap::GetFontIndex(const ByteString& sFontName,
int32_t nCharset,
bool bFind) {
int32_t nFontIndex = FindFont(EncodeFontAlias(sFontName, nCharset), nCharset);
if (nFontIndex >= 0)
return nFontIndex;
- CFX_ByteString sAlias;
+ ByteString sAlias;
CPDF_Font* pFont = bFind ? FindFontSameCharset(&sAlias, nCharset) : nullptr;
if (!pFont) {
- CFX_ByteString sTemp = sFontName;
+ ByteString sTemp = sFontName;
pFont = AddFontToDocument(GetDocument(), sTemp, nCharset);
sAlias = EncodeFontAlias(sTemp, nCharset);
}
@@ -189,13 +188,13 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName,
return AddFontData(pFont, sAlias, nCharset);
}
-CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias,
+CPDF_Font* CPWL_FontMap::FindFontSameCharset(ByteString* sFontAlias,
int32_t nCharset) {
return nullptr;
}
int32_t CPWL_FontMap::AddFontData(CPDF_Font* pFont,
- const CFX_ByteString& sFontAlias,
+ const ByteString& sFontAlias,
int32_t nCharset) {
auto pNewData = pdfium::MakeUnique<CPWL_FontMap_Data>();
pNewData->pFont = pFont;
@@ -205,22 +204,21 @@ int32_t CPWL_FontMap::AddFontData(CPDF_Font* pFont,
return pdfium::CollectionSize<int32_t>(m_Data) - 1;
}
-void CPWL_FontMap::AddedFont(CPDF_Font* pFont,
- const CFX_ByteString& sFontAlias) {}
+void CPWL_FontMap::AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) {}
-CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) {
+ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) {
if (nCharset == FX_CHARSET_Default)
nCharset = GetNativeCharset();
- CFX_ByteString sFontName = GetDefaultFontByCharset(nCharset);
+ ByteString sFontName = GetDefaultFontByCharset(nCharset);
if (!m_pSystemHandler->FindNativeTrueTypeFont(sFontName))
- return CFX_ByteString();
+ return ByteString();
return sFontName;
}
CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc,
- CFX_ByteString& sFontName,
+ ByteString& sFontName,
uint8_t nCharset) {
if (IsStandardFont(sFontName))
return AddStandardFont(pDoc, sFontName);
@@ -229,7 +227,7 @@ CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc,
}
CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc,
- CFX_ByteString& sFontName) {
+ ByteString& sFontName) {
if (!pDoc)
return nullptr;
@@ -246,7 +244,7 @@ CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc,
}
CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc,
- CFX_ByteString& sFontName,
+ ByteString& sFontName,
uint8_t nCharset) {
if (!pDoc)
return nullptr;
@@ -260,15 +258,15 @@ CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc,
nCharset);
}
-CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName,
- int32_t nCharset) {
- CFX_ByteString sPostfix;
+ByteString CPWL_FontMap::EncodeFontAlias(const ByteString& sFontName,
+ int32_t nCharset) {
+ ByteString sPostfix;
sPostfix.Format("_%02X", nCharset);
return EncodeFontAlias(sFontName) + sPostfix;
}
-CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName) {
- CFX_ByteString sRet = sFontName;
+ByteString CPWL_FontMap::EncodeFontAlias(const ByteString& sFontName) {
+ ByteString sRet = sFontName;
sRet.Remove(' ');
return sRet;
}
@@ -349,7 +347,7 @@ const FPDF_CharsetFontMap CPWL_FontMap::defaultTTFMap[] = {
{FX_CHARSET_MSWin_Arabic, "Arial"},
{-1, nullptr}};
-CFX_ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) {
+ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) {
int i = 0;
while (defaultTTFMap[i].charset != -1) {
if (nCharset == defaultTTFMap[i].charset)
diff --git a/fpdfsdk/pwl/cpwl_font_map.h b/fpdfsdk/pwl/cpwl_font_map.h
index 9872779c95..5336949399 100644
--- a/fpdfsdk/pwl/cpwl_font_map.h
+++ b/fpdfsdk/pwl/cpwl_font_map.h
@@ -21,12 +21,12 @@ class CFX_SystemHandler;
struct CPWL_FontMap_Data {
CPDF_Font* pFont;
int32_t nCharset;
- CFX_ByteString sFontName;
+ ByteString sFontName;
};
struct CPWL_FontMap_Native {
int32_t nCharset;
- CFX_ByteString sFontName;
+ ByteString sFontName;
};
class CPWL_FontMap : public IPVT_FontMap {
@@ -36,7 +36,7 @@ class CPWL_FontMap : public IPVT_FontMap {
// IPVT_FontMap
CPDF_Font* GetPDFFont(int32_t nFontIndex) override;
- CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override;
+ ByteString GetPDFFontAlias(int32_t nFontIndex) override;
int32_t GetWordFontIndex(uint16_t word,
int32_t nCharset,
int32_t nFontIndex) override;
@@ -45,47 +45,46 @@ class CPWL_FontMap : public IPVT_FontMap {
const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const;
static int32_t GetNativeCharset();
- CFX_ByteString GetNativeFontName(int32_t nCharset);
+ ByteString GetNativeFontName(int32_t nCharset);
- static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset);
+ static ByteString GetDefaultFontByCharset(int32_t nCharset);
static const FPDF_CharsetFontMap defaultTTFMap[];
protected:
virtual void Initialize();
virtual CPDF_Document* GetDocument();
- virtual CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias,
+ virtual CPDF_Font* FindFontSameCharset(ByteString* sFontAlias,
int32_t nCharset);
- virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
+ virtual void AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias);
bool KnowWord(int32_t nFontIndex, uint16_t word);
void Empty();
- int32_t GetFontIndex(const CFX_ByteString& sFontName,
+ int32_t GetFontIndex(const ByteString& sFontName,
int32_t nCharset,
bool bFind);
int32_t AddFontData(CPDF_Font* pFont,
- const CFX_ByteString& sFontAlias,
+ const ByteString& sFontAlias,
int32_t nCharset = FX_CHARSET_Default);
- CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName,
- int32_t nCharset);
- CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName);
+ ByteString EncodeFontAlias(const ByteString& sFontName, int32_t nCharset);
+ ByteString EncodeFontAlias(const ByteString& sFontName);
std::vector<std::unique_ptr<CPWL_FontMap_Data>> m_Data;
std::vector<std::unique_ptr<CPWL_FontMap_Native>> m_NativeFont;
private:
- int32_t FindFont(const CFX_ByteString& sFontName,
+ int32_t FindFont(const ByteString& sFontName,
int32_t nCharset = FX_CHARSET_Default);
- CFX_ByteString GetNativeFont(int32_t nCharset);
+ ByteString GetNativeFont(int32_t nCharset);
CPDF_Font* AddFontToDocument(CPDF_Document* pDoc,
- CFX_ByteString& sFontName,
+ ByteString& sFontName,
uint8_t nCharset);
- bool IsStandardFont(const CFX_ByteString& sFontName);
- CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName);
+ bool IsStandardFont(const ByteString& sFontName);
+ CPDF_Font* AddStandardFont(CPDF_Document* pDoc, ByteString& sFontName);
CPDF_Font* AddSystemFont(CPDF_Document* pDoc,
- CFX_ByteString& sFontName,
+ ByteString& sFontName,
uint8_t nCharset);
std::unique_ptr<CPDF_Document> m_pPDFDoc;
diff --git a/fpdfsdk/pwl/cpwl_icon.cpp b/fpdfsdk/pwl/cpwl_icon.cpp
index 8a2e31da6a..e7669b3d20 100644
--- a/fpdfsdk/pwl/cpwl_icon.cpp
+++ b/fpdfsdk/pwl/cpwl_icon.cpp
@@ -37,12 +37,12 @@ CFX_Matrix CPWL_Icon::GetImageMatrix() {
return CFX_Matrix();
}
-CFX_ByteString CPWL_Icon::GetImageAlias() {
+ByteString CPWL_Icon::GetImageAlias() {
if (!m_pPDFStream)
- return CFX_ByteString();
+ return ByteString();
if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict())
return pDict->GetStringFor("Name");
- return CFX_ByteString();
+ return ByteString();
}
std::pair<float, float> CPWL_Icon::GetIconPosition() {
diff --git a/fpdfsdk/pwl/cpwl_icon.h b/fpdfsdk/pwl/cpwl_icon.h
index 2607e56890..e2f792b9d5 100644
--- a/fpdfsdk/pwl/cpwl_icon.h
+++ b/fpdfsdk/pwl/cpwl_icon.h
@@ -28,7 +28,7 @@ class CPWL_Icon : public CPWL_Wnd {
std::pair<float, float> GetImageOffset();
CFX_Matrix GetImageMatrix();
- CFX_ByteString GetImageAlias();
+ ByteString GetImageAlias();
private:
// left, bottom
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp
index 4090e792e4..b5c629392b 100644
--- a/fpdfsdk/pwl/cpwl_list_box.cpp
+++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -72,7 +72,7 @@ CPWL_ListBox::CPWL_ListBox()
CPWL_ListBox::~CPWL_ListBox() {}
-CFX_ByteString CPWL_ListBox::GetClassName() const {
+ByteString CPWL_ListBox::GetClassName() const {
return "CPWL_ListBox";
}
@@ -260,8 +260,8 @@ bool CPWL_ListBox::OnNotifySelectionChanged(bool bKeyDown, uint32_t nFlag) {
if (!m_pFillerNotify)
return false;
- CFX_WideString swChange = GetText();
- CFX_WideString strChangeEx;
+ WideString swChange = GetText();
+ WideString strChangeEx;
int nSelStart = 0;
int nSelEnd = swChange.GetLength();
bool bRC;
@@ -282,11 +282,11 @@ CFX_FloatRect CPWL_ListBox::GetFocusRect() const {
return CPWL_Wnd::GetFocusRect();
}
-void CPWL_ListBox::AddString(const CFX_WideString& str) {
+void CPWL_ListBox::AddString(const WideString& str) {
m_pList->AddString(str);
}
-CFX_WideString CPWL_ListBox::GetText() const {
+WideString CPWL_ListBox::GetText() const {
return m_pList->GetText();
}
diff --git a/fpdfsdk/pwl/cpwl_list_box.h b/fpdfsdk/pwl/cpwl_list_box.h
index f620ec1050..1e028f7299 100644
--- a/fpdfsdk/pwl/cpwl_list_box.h
+++ b/fpdfsdk/pwl/cpwl_list_box.h
@@ -44,7 +44,7 @@ class CPWL_ListBox : public CPWL_Wnd {
~CPWL_ListBox() override;
// CPWL_Wnd
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreated() override;
void OnDestroy() override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
@@ -66,11 +66,11 @@ class CPWL_ListBox : public CPWL_Wnd {
void SetFontSize(float fFontSize) override;
float GetFontSize() const override;
- virtual CFX_WideString GetText() const;
+ virtual WideString GetText() const;
bool OnNotifySelectionChanged(bool bKeyDown, uint32_t nFlag);
- void AddString(const CFX_WideString& str);
+ void AddString(const WideString& str);
void SetTopVisibleIndex(int32_t nItemIndex);
void ScrollToListItem(int32_t nItemIndex);
void ResetContent();
diff --git a/fpdfsdk/pwl/cpwl_list_impl.cpp b/fpdfsdk/pwl/cpwl_list_impl.cpp
index 94e0606941..da455d06cb 100644
--- a/fpdfsdk/pwl/cpwl_list_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_list_impl.cpp
@@ -29,7 +29,7 @@ void CPWL_ListCtrl::Item::SetFontMap(IPVT_FontMap* pFontMap) {
m_pEdit->SetFontMap(pFontMap);
}
-void CPWL_ListCtrl::Item::SetText(const CFX_WideString& text) {
+void CPWL_ListCtrl::Item::SetText(const WideString& text) {
m_pEdit->SetText(text);
}
@@ -49,7 +49,7 @@ uint16_t CPWL_ListCtrl::Item::GetFirstChar() const {
return word.Word;
}
-CFX_WideString CPWL_ListCtrl::Item::GetText() const {
+WideString CPWL_ListCtrl::Item::GetText() const {
return m_pEdit->GetText();
}
@@ -310,7 +310,7 @@ CFX_FloatRect CPWL_ListCtrl::GetItemRectInternal(int32_t nIndex) const {
return InnerToOuter(rcItem);
}
-void CPWL_ListCtrl::AddString(const CFX_WideString& str) {
+void CPWL_ListCtrl::AddString(const WideString& str) {
AddItem(str);
ReArrange(GetCount() - 1);
}
@@ -551,13 +551,13 @@ int32_t CPWL_ListCtrl::GetItemIndex(const CFX_PointF& point) const {
return -1;
}
-CFX_WideString CPWL_ListCtrl::GetText() const {
+WideString CPWL_ListCtrl::GetText() const {
if (IsMultipleSel())
return GetItemText(m_nCaretIndex);
return GetItemText(m_nSelItem);
}
-void CPWL_ListCtrl::AddItem(const CFX_WideString& str) {
+void CPWL_ListCtrl::AddItem(const WideString& str) {
auto pListItem = pdfium::MakeUnique<Item>();
pListItem->SetFontMap(m_pFontMap.Get());
pListItem->SetFontSize(m_fFontSize);
@@ -630,7 +630,7 @@ bool CPWL_ListCtrl::IsValid(int32_t nItemIndex) const {
return pdfium::IndexInBounds(m_ListItems, nItemIndex);
}
-CFX_WideString CPWL_ListCtrl::GetItemText(int32_t nIndex) const {
+WideString CPWL_ListCtrl::GetItemText(int32_t nIndex) const {
if (pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex])
return m_ListItems[nIndex]->GetText();
return L"";
diff --git a/fpdfsdk/pwl/cpwl_list_impl.h b/fpdfsdk/pwl/cpwl_list_impl.h
index 9bb0d2969c..18ca0a3a15 100644
--- a/fpdfsdk/pwl/cpwl_list_impl.h
+++ b/fpdfsdk/pwl/cpwl_list_impl.h
@@ -68,13 +68,13 @@ class CPWL_ListCtrl {
CFX_FloatRect GetContentRect() const;
int32_t GetItemIndex(const CFX_PointF& point) const;
- void AddString(const CFX_WideString& str);
+ void AddString(const WideString& str);
void SetTopItem(int32_t nIndex);
void Select(int32_t nItemIndex);
void SetCaret(int32_t nItemIndex);
void Empty();
void Cancel();
- CFX_WideString GetText() const;
+ WideString GetText() const;
void SetFontMap(IPVT_FontMap* pFontMap) { m_pFontMap = pFontMap; }
void SetFontSize(float fFontSize) { m_fFontSize = fFontSize; }
@@ -102,9 +102,9 @@ class CPWL_ListCtrl {
void SetRect(const CFX_FloatRect& rect) { m_rcListItem = rect; }
void SetSelect(bool bSelected) { m_bSelected = bSelected; }
- void SetText(const CFX_WideString& text);
+ void SetText(const WideString& text);
void SetFontSize(float fFontSize);
- CFX_WideString GetText() const;
+ WideString GetText() const;
CFX_FloatRect GetRect() const { return m_rcListItem; }
bool IsSelected() const { return m_bSelected; }
@@ -142,8 +142,8 @@ class CPWL_ListCtrl {
bool IsItemVisible(int32_t nItemIndex) const;
void SetScrollInfo();
void SetScrollPosY(float fy);
- void AddItem(const CFX_WideString& str);
- CFX_WideString GetItemText(int32_t nIndex) const;
+ void AddItem(const WideString& str);
+ WideString GetItemText(int32_t nIndex) const;
void SetItemSelect(int32_t nItemIndex, bool bSelected);
int32_t GetLastSelected() const;
CFX_PointF GetBTPoint() const {
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
index 15247293a0..e50f778943 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
@@ -127,7 +127,7 @@ CPWL_SBButton::CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType,
CPWL_SBButton::~CPWL_SBButton() {}
-CFX_ByteString CPWL_SBButton::GetClassName() const {
+ByteString CPWL_SBButton::GetClassName() const {
return "CPWL_SBButton";
}
@@ -325,7 +325,7 @@ CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType)
CPWL_ScrollBar::~CPWL_ScrollBar() {}
-CFX_ByteString CPWL_ScrollBar::GetClassName() const {
+ByteString CPWL_ScrollBar::GetClassName() const {
return "CPWL_ScrollBar";
}
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.h b/fpdfsdk/pwl/cpwl_scroll_bar.h
index 44c72cbbe2..48aef16e38 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.h
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.h
@@ -49,7 +49,7 @@ class CPWL_SBButton : public CPWL_Wnd {
~CPWL_SBButton() override;
// CPWL_Wnd
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreate(CreateParams* pParamsToAdjust) override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) override;
@@ -121,7 +121,7 @@ class CPWL_ScrollBar : public CPWL_Wnd {
~CPWL_ScrollBar() override;
// CPWL_Wnd:
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
void OnCreate(CreateParams* pParamsToAdjust) override;
void OnDestroy() override;
void RePosChildWnd() override;
diff --git a/fpdfsdk/pwl/cpwl_special_button.cpp b/fpdfsdk/pwl/cpwl_special_button.cpp
index 53f7f2c1d0..ddca67e5d1 100644
--- a/fpdfsdk/pwl/cpwl_special_button.cpp
+++ b/fpdfsdk/pwl/cpwl_special_button.cpp
@@ -12,7 +12,7 @@ CPWL_PushButton::CPWL_PushButton() {}
CPWL_PushButton::~CPWL_PushButton() {}
-CFX_ByteString CPWL_PushButton::GetClassName() const {
+ByteString CPWL_PushButton::GetClassName() const {
return "CPWL_PushButton";
}
@@ -25,7 +25,7 @@ CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(false) {}
CPWL_CheckBox::~CPWL_CheckBox() {}
-CFX_ByteString CPWL_CheckBox::GetClassName() const {
+ByteString CPWL_CheckBox::GetClassName() const {
return "CPWL_CheckBox";
}
@@ -54,7 +54,7 @@ CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(false) {}
CPWL_RadioButton::~CPWL_RadioButton() {}
-CFX_ByteString CPWL_RadioButton::GetClassName() const {
+ByteString CPWL_RadioButton::GetClassName() const {
return "CPWL_RadioButton";
}
diff --git a/fpdfsdk/pwl/cpwl_special_button.h b/fpdfsdk/pwl/cpwl_special_button.h
index b499542795..076b5298ed 100644
--- a/fpdfsdk/pwl/cpwl_special_button.h
+++ b/fpdfsdk/pwl/cpwl_special_button.h
@@ -15,7 +15,7 @@ class CPWL_PushButton : public CPWL_Button {
~CPWL_PushButton() override;
// CPWL_Button
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
CFX_FloatRect GetFocusRect() const override;
};
@@ -25,7 +25,7 @@ class CPWL_CheckBox : public CPWL_Button {
~CPWL_CheckBox() override;
// CPWL_Button
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
bool OnChar(uint16_t nChar, uint32_t nFlag) override;
@@ -42,7 +42,7 @@ class CPWL_RadioButton : public CPWL_Button {
~CPWL_RadioButton() override;
// CPWL_Button
- CFX_ByteString GetClassName() const override;
+ ByteString GetClassName() const override;
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
bool OnChar(uint16_t nChar, uint32_t nFlag) override;
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 401fed3f9c..1c1512e296 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -146,7 +146,7 @@ CPWL_Wnd::~CPWL_Wnd() {
ASSERT(!m_bCreated);
}
-CFX_ByteString CPWL_Wnd::GetClassName() const {
+ByteString CPWL_Wnd::GetClassName() const {
return "CPWL_Wnd";
}
@@ -361,11 +361,11 @@ PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp)
PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove)
#undef PWL_IMPLEMENT_MOUSE_METHOD
-CFX_WideString CPWL_Wnd::GetSelectedText() {
- return CFX_WideString();
+WideString CPWL_Wnd::GetSelectedText() {
+ return WideString();
}
-void CPWL_Wnd::ReplaceSelection(const CFX_WideString& text) {}
+void CPWL_Wnd::ReplaceSelection(const WideString& text) {}
bool CPWL_Wnd::OnMouseWheel(short zDelta,
const CFX_PointF& point,
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 2fd5077a86..17ed06450a 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -152,7 +152,7 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
CPWL_Wnd();
~CPWL_Wnd() override;
- virtual CFX_ByteString GetClassName() const;
+ virtual ByteString GetClassName() const;
virtual void InvalidateRect(CFX_FloatRect* pRect);
virtual bool OnKeyDown(uint16_t nChar, uint32_t nFlag);
@@ -179,8 +179,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
virtual void SetFontSize(float fFontSize);
virtual float GetFontSize() const;
- virtual CFX_WideString GetSelectedText();
- virtual void ReplaceSelection(const CFX_WideString& text);
+ virtual WideString GetSelectedText();
+ virtual void ReplaceSelection(const WideString& text);
virtual CFX_FloatRect GetFocusRect() const;
virtual CFX_FloatRect GetClientRect() const;
diff --git a/fxbarcode/BC_UtilCodingConvert.cpp b/fxbarcode/BC_UtilCodingConvert.cpp
index f0f497a07b..77c52f2074 100644
--- a/fxbarcode/BC_UtilCodingConvert.cpp
+++ b/fxbarcode/BC_UtilCodingConvert.cpp
@@ -10,43 +10,42 @@ CBC_UtilCodingConvert::CBC_UtilCodingConvert() {}
CBC_UtilCodingConvert::~CBC_UtilCodingConvert() {}
-void CBC_UtilCodingConvert::UnicodeToLocale(const CFX_WideString& src,
- CFX_ByteString& dst) {
- dst = CFX_ByteString::FromUnicode(src);
+void CBC_UtilCodingConvert::UnicodeToLocale(const WideString& src,
+ ByteString& dst) {
+ dst = ByteString::FromUnicode(src);
}
-void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
- CFX_ByteString& dst) {
- CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC());
+void CBC_UtilCodingConvert::LocaleToUtf8(const ByteString& src,
+ ByteString& dst) {
+ WideString unicode = WideString::FromLocal(src.AsStringView());
dst = unicode.UTF8Encode();
}
-void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
+void CBC_UtilCodingConvert::LocaleToUtf8(const ByteString& src,
std::vector<uint8_t>& dst) {
- CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC());
- CFX_ByteString utf8 = unicode.UTF8Encode();
+ WideString unicode = WideString::FromLocal(src.AsStringView());
+ ByteString utf8 = unicode.UTF8Encode();
dst = std::vector<uint8_t>(utf8.begin(), utf8.end());
}
void CBC_UtilCodingConvert::Utf8ToLocale(const std::vector<uint8_t>& src,
- CFX_ByteString& dst) {
- CFX_ByteString utf8;
+ ByteString& dst) {
+ ByteString utf8;
for (uint8_t value : src)
utf8 += value;
- CFX_WideString unicode = CFX_WideString::FromUTF8(utf8.AsStringC());
- dst = CFX_ByteString::FromUnicode(unicode);
+ WideString unicode = WideString::FromUTF8(utf8.AsStringView());
+ dst = ByteString::FromUnicode(unicode);
}
void CBC_UtilCodingConvert::Utf8ToLocale(const uint8_t* src,
int32_t count,
- CFX_ByteString& dst) {
- CFX_WideString unicode =
- CFX_WideString::FromUTF8(CFX_ByteStringC(src, count));
- dst = CFX_ByteString::FromUnicode(unicode);
+ ByteString& dst) {
+ WideString unicode = WideString::FromUTF8(ByteStringView(src, count));
+ dst = ByteString::FromUnicode(unicode);
}
-void CBC_UtilCodingConvert::UnicodeToUTF8(const CFX_WideString& src,
- CFX_ByteString& dst) {
+void CBC_UtilCodingConvert::UnicodeToUTF8(const WideString& src,
+ ByteString& dst) {
dst = src.UTF8Encode();
}
diff --git a/fxbarcode/BC_UtilCodingConvert.h b/fxbarcode/BC_UtilCodingConvert.h
index de6b30eb7c..8600cd14b5 100644
--- a/fxbarcode/BC_UtilCodingConvert.h
+++ b/fxbarcode/BC_UtilCodingConvert.h
@@ -15,19 +15,16 @@ class CBC_UtilCodingConvert {
public:
CBC_UtilCodingConvert();
virtual ~CBC_UtilCodingConvert();
- static void UnicodeToLocale(const CFX_WideString& source,
- CFX_ByteString& result);
- static void LocaleToUtf8(const CFX_ByteString& source,
- CFX_ByteString& result);
- static void LocaleToUtf8(const CFX_ByteString& source,
+ static void UnicodeToLocale(const WideString& source, ByteString& result);
+ static void LocaleToUtf8(const ByteString& source, ByteString& result);
+ static void LocaleToUtf8(const ByteString& source,
std::vector<uint8_t>& result);
static void Utf8ToLocale(const std::vector<uint8_t>& source,
- CFX_ByteString& result);
+ ByteString& result);
static void Utf8ToLocale(const uint8_t* source,
int32_t count,
- CFX_ByteString& result);
- static void UnicodeToUTF8(const CFX_WideString& source,
- CFX_ByteString& result);
+ ByteString& result);
+ static void UnicodeToUTF8(const WideString& source, ByteString& result);
};
#endif // FXBARCODE_BC_UTILCODINGCONVERT_H_
diff --git a/fxbarcode/BC_Utils.cpp b/fxbarcode/BC_Utils.cpp
index 284322e832..1d09e24736 100644
--- a/fxbarcode/BC_Utils.cpp
+++ b/fxbarcode/BC_Utils.cpp
@@ -8,7 +8,7 @@
#include "fxbarcode/utils.h"
-bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
+bool BC_FX_ByteString_Replace(ByteString& dst,
uint32_t first,
uint32_t last,
int32_t count,
@@ -23,12 +23,11 @@ bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
return true;
}
-void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c) {
+void BC_FX_ByteString_Append(ByteString& dst, int32_t count, char c) {
for (int32_t i = 0; i < count; i++)
dst += c;
}
-void BC_FX_ByteString_Append(CFX_ByteString& dst,
- const std::vector<uint8_t>& ba) {
+void BC_FX_ByteString_Append(ByteString& dst, const std::vector<uint8_t>& ba) {
for (uint8_t value : ba)
dst += value;
}
diff --git a/fxbarcode/cbc_codabar.cpp b/fxbarcode/cbc_codabar.cpp
index a8729b64c6..0795ff295d 100644
--- a/fxbarcode/cbc_codabar.cpp
+++ b/fxbarcode/cbc_codabar.cpp
@@ -47,16 +47,15 @@ bool CBC_Codabar::SetWideNarrowRatio(int8_t ratio) {
return GetOnedCodaBarWriter()->SetWideNarrowRatio(ratio);
}
-bool CBC_Codabar::Encode(const CFX_WideStringC& contents) {
+bool CBC_Codabar::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
BCFORMAT format = BCFORMAT_CODABAR;
int32_t outWidth = 0;
int32_t outHeight = 0;
- CFX_WideString filtercontents =
- GetOnedCodaBarWriter()->FilterContents(contents);
- CFX_ByteString byteString = filtercontents.UTF8Encode();
+ WideString filtercontents = GetOnedCodaBarWriter()->FilterContents(contents);
+ ByteString byteString = filtercontents.UTF8Encode();
m_renderContents = filtercontents;
auto* pWriter = GetOnedCodaBarWriter();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
@@ -64,16 +63,16 @@ bool CBC_Codabar::Encode(const CFX_WideStringC& contents) {
if (!data)
return false;
- return pWriter->RenderResult(filtercontents.AsStringC(), data.get(),
+ return pWriter->RenderResult(filtercontents.AsStringView(), data.get(),
outWidth);
}
bool CBC_Codabar::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
auto* pWriter = GetOnedCodaBarWriter();
- CFX_WideString renderCon =
- pWriter->encodedContents(m_renderContents.AsStringC());
- return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringC());
+ WideString renderCon =
+ pWriter->encodedContents(m_renderContents.AsStringView());
+ return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringView());
}
BC_TYPE CBC_Codabar::GetType() {
diff --git a/fxbarcode/cbc_codabar.h b/fxbarcode/cbc_codabar.h
index 092b840f49..827fc28d0f 100644
--- a/fxbarcode/cbc_codabar.h
+++ b/fxbarcode/cbc_codabar.h
@@ -20,7 +20,7 @@ class CBC_Codabar : public CBC_OneCode {
~CBC_Codabar() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
@@ -33,7 +33,7 @@ class CBC_Codabar : public CBC_OneCode {
private:
CBC_OnedCodaBarWriter* GetOnedCodaBarWriter();
- CFX_WideString m_renderContents;
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_CODABAR_H_
diff --git a/fxbarcode/cbc_code128.cpp b/fxbarcode/cbc_code128.cpp
index d802b28a17..7ba623542d 100644
--- a/fxbarcode/cbc_code128.cpp
+++ b/fxbarcode/cbc_code128.cpp
@@ -35,7 +35,7 @@ bool CBC_Code128::SetTextLocation(BC_TEXT_LOC location) {
return GetOnedCode128Writer()->SetTextLocation(location);
}
-bool CBC_Code128::Encode(const CFX_WideStringC& contents) {
+bool CBC_Code128::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
@@ -43,25 +43,25 @@ bool CBC_Code128::Encode(const CFX_WideStringC& contents) {
int32_t outWidth = 0;
int32_t outHeight = 0;
auto* pWriter = GetOnedCode128Writer();
- CFX_WideString content(contents);
+ WideString content(contents);
if (contents.GetLength() % 2 && pWriter->GetType() == BC_CODE128_C)
content += '0';
- CFX_WideString encodeContents = pWriter->FilterContents(content.AsStringC());
+ WideString encodeContents = pWriter->FilterContents(content.AsStringView());
m_renderContents = encodeContents;
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.UTF8Encode();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(encodeContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(encodeContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_Code128::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
return GetOnedCode128Writer()->RenderDeviceResult(
- device, matrix, m_renderContents.AsStringC());
+ device, matrix, m_renderContents.AsStringView());
}
BC_TYPE CBC_Code128::GetType() {
diff --git a/fxbarcode/cbc_code128.h b/fxbarcode/cbc_code128.h
index 571ee7e5a0..b057aff2af 100644
--- a/fxbarcode/cbc_code128.h
+++ b/fxbarcode/cbc_code128.h
@@ -20,7 +20,7 @@ class CBC_Code128 : public CBC_OneCode {
~CBC_Code128() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
@@ -30,7 +30,7 @@ class CBC_Code128 : public CBC_OneCode {
private:
CBC_OnedCode128Writer* GetOnedCode128Writer();
- CFX_WideString m_renderContents;
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_CODE128_H_
diff --git a/fxbarcode/cbc_code39.cpp b/fxbarcode/cbc_code39.cpp
index a46af14b9a..9715c25828 100644
--- a/fxbarcode/cbc_code39.cpp
+++ b/fxbarcode/cbc_code39.cpp
@@ -31,7 +31,7 @@ CBC_Code39::CBC_Code39()
CBC_Code39::~CBC_Code39() {}
-bool CBC_Code39::Encode(const CFX_WideStringC& contents) {
+bool CBC_Code39::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
@@ -39,25 +39,25 @@ bool CBC_Code39::Encode(const CFX_WideStringC& contents) {
int32_t outWidth = 0;
int32_t outHeight = 0;
auto* pWriter = GetOnedCode39Writer();
- CFX_WideString filtercontents = pWriter->FilterContents(contents);
- CFX_WideString renderContents = pWriter->RenderTextContents(contents);
+ WideString filtercontents = pWriter->FilterContents(contents);
+ WideString renderContents = pWriter->RenderTextContents(contents);
m_renderContents = renderContents;
- CFX_ByteString byteString = filtercontents.UTF8Encode();
+ ByteString byteString = filtercontents.UTF8Encode();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(renderContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(renderContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_Code39::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
auto* pWriter = GetOnedCode39Writer();
- CFX_WideString renderCon;
- if (!pWriter->encodedContents(m_renderContents.AsStringC(), &renderCon))
+ WideString renderCon;
+ if (!pWriter->encodedContents(m_renderContents.AsStringView(), &renderCon))
return false;
- return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringC());
+ return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringView());
}
BC_TYPE CBC_Code39::GetType() {
diff --git a/fxbarcode/cbc_code39.h b/fxbarcode/cbc_code39.h
index 66974c0947..937673c740 100644
--- a/fxbarcode/cbc_code39.h
+++ b/fxbarcode/cbc_code39.h
@@ -21,7 +21,7 @@ class CBC_Code39 : public CBC_OneCode {
~CBC_Code39() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
@@ -32,7 +32,7 @@ class CBC_Code39 : public CBC_OneCode {
private:
CBC_OnedCode39Writer* GetOnedCode39Writer();
- CFX_WideString m_renderContents;
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_CODE39_H_
diff --git a/fxbarcode/cbc_codebase.h b/fxbarcode/cbc_codebase.h
index f1a7b03ae2..aab98da32b 100644
--- a/fxbarcode/cbc_codebase.h
+++ b/fxbarcode/cbc_codebase.h
@@ -26,7 +26,7 @@ class CBC_CodeBase {
virtual ~CBC_CodeBase();
virtual BC_TYPE GetType() = 0;
- virtual bool Encode(const CFX_WideStringC& contents) = 0;
+ virtual bool Encode(const WideStringView& contents) = 0;
virtual bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) = 0;
diff --git a/fxbarcode/cbc_datamatrix.cpp b/fxbarcode/cbc_datamatrix.cpp
index 91ed10e8e0..c9e23fa7ae 100644
--- a/fxbarcode/cbc_datamatrix.cpp
+++ b/fxbarcode/cbc_datamatrix.cpp
@@ -31,12 +31,12 @@ CBC_DataMatrix::CBC_DataMatrix()
CBC_DataMatrix::~CBC_DataMatrix() {}
-bool CBC_DataMatrix::Encode(const CFX_WideStringC& contents) {
+bool CBC_DataMatrix::Encode(const WideStringView& contents) {
int32_t outWidth = 0;
int32_t outHeight = 0;
auto* pWriter = GetDataMatrixWriter();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(CFX_WideString(contents), outWidth, outHeight));
+ pWriter->Encode(WideString(contents), outWidth, outHeight));
if (!data)
return false;
return pWriter->RenderResult(data.get(), outWidth, outHeight);
diff --git a/fxbarcode/cbc_datamatrix.h b/fxbarcode/cbc_datamatrix.h
index 9f6c914fb4..3fe1c09326 100644
--- a/fxbarcode/cbc_datamatrix.h
+++ b/fxbarcode/cbc_datamatrix.h
@@ -20,7 +20,7 @@ class CBC_DataMatrix : public CBC_CodeBase {
~CBC_DataMatrix() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
diff --git a/fxbarcode/cbc_ean13.cpp b/fxbarcode/cbc_ean13.cpp
index 3606527142..16725323f4 100644
--- a/fxbarcode/cbc_ean13.cpp
+++ b/fxbarcode/cbc_ean13.cpp
@@ -31,15 +31,15 @@ CBC_EAN13::CBC_EAN13()
CBC_EAN13::~CBC_EAN13() {}
-CFX_WideString CBC_EAN13::Preprocess(const CFX_WideStringC& contents) {
+WideString CBC_EAN13::Preprocess(const WideStringView& contents) {
auto* pWriter = GetOnedEAN13Writer();
- CFX_WideString encodeContents = pWriter->FilterContents(contents);
+ WideString encodeContents = pWriter->FilterContents(contents);
int32_t length = encodeContents.GetLength();
if (length <= 12) {
for (int32_t i = 0; i < 12 - length; i++)
encodeContents = wchar_t('0') + encodeContents;
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.UTF8Encode();
int32_t checksum = pWriter->CalcChecksum(byteString);
byteString += checksum - 0 + '0';
encodeContents = byteString.UTF8Decode();
@@ -50,29 +50,29 @@ CFX_WideString CBC_EAN13::Preprocess(const CFX_WideStringC& contents) {
return encodeContents;
}
-bool CBC_EAN13::Encode(const CFX_WideStringC& contents) {
+bool CBC_EAN13::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
BCFORMAT format = BCFORMAT_EAN_13;
int32_t outWidth = 0;
int32_t outHeight = 0;
- CFX_WideString encodeContents = Preprocess(contents);
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ WideString encodeContents = Preprocess(contents);
+ ByteString byteString = encodeContents.UTF8Encode();
m_renderContents = encodeContents;
auto* pWriter = GetOnedEAN13Writer();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(encodeContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(encodeContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_EAN13::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
- return GetOnedEAN13Writer()->RenderDeviceResult(device, matrix,
- m_renderContents.AsStringC());
+ return GetOnedEAN13Writer()->RenderDeviceResult(
+ device, matrix, m_renderContents.AsStringView());
}
BC_TYPE CBC_EAN13::GetType() {
diff --git a/fxbarcode/cbc_ean13.h b/fxbarcode/cbc_ean13.h
index 8a62151685..609f8b0dc2 100644
--- a/fxbarcode/cbc_ean13.h
+++ b/fxbarcode/cbc_ean13.h
@@ -21,16 +21,16 @@ class CBC_EAN13 : public CBC_OneCode {
~CBC_EAN13() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
private:
CBC_OnedEAN13Writer* GetOnedEAN13Writer();
- CFX_WideString Preprocess(const CFX_WideStringC& contents);
+ WideString Preprocess(const WideStringView& contents);
- CFX_WideString m_renderContents;
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_EAN13_H_
diff --git a/fxbarcode/cbc_ean8.cpp b/fxbarcode/cbc_ean8.cpp
index 7fbe07fd7f..796f3a526b 100644
--- a/fxbarcode/cbc_ean8.cpp
+++ b/fxbarcode/cbc_ean8.cpp
@@ -30,15 +30,15 @@ CBC_EAN8::CBC_EAN8() : CBC_OneCode(pdfium::MakeUnique<CBC_OnedEAN8Writer>()) {}
CBC_EAN8::~CBC_EAN8() {}
-CFX_WideString CBC_EAN8::Preprocess(const CFX_WideStringC& contents) {
+WideString CBC_EAN8::Preprocess(const WideStringView& contents) {
auto* pWriter = GetOnedEAN8Writer();
- CFX_WideString encodeContents = pWriter->FilterContents(contents);
+ WideString encodeContents = pWriter->FilterContents(contents);
int32_t length = encodeContents.GetLength();
if (length <= 7) {
for (int32_t i = 0; i < 7 - length; i++)
encodeContents = wchar_t('0') + encodeContents;
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.UTF8Encode();
int32_t checksum = pWriter->CalcChecksum(byteString);
encodeContents += wchar_t(checksum - 0 + '0');
}
@@ -48,29 +48,29 @@ CFX_WideString CBC_EAN8::Preprocess(const CFX_WideStringC& contents) {
return encodeContents;
}
-bool CBC_EAN8::Encode(const CFX_WideStringC& contents) {
+bool CBC_EAN8::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
BCFORMAT format = BCFORMAT_EAN_8;
int32_t outWidth = 0;
int32_t outHeight = 0;
- CFX_WideString encodeContents = Preprocess(contents);
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ WideString encodeContents = Preprocess(contents);
+ ByteString byteString = encodeContents.UTF8Encode();
m_renderContents = encodeContents;
auto* pWriter = GetOnedEAN8Writer();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(encodeContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(encodeContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_EAN8::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
- return GetOnedEAN8Writer()->RenderDeviceResult(device, matrix,
- m_renderContents.AsStringC());
+ return GetOnedEAN8Writer()->RenderDeviceResult(
+ device, matrix, m_renderContents.AsStringView());
}
BC_TYPE CBC_EAN8::GetType() {
diff --git a/fxbarcode/cbc_ean8.h b/fxbarcode/cbc_ean8.h
index df0ca6246a..4127650c44 100644
--- a/fxbarcode/cbc_ean8.h
+++ b/fxbarcode/cbc_ean8.h
@@ -20,15 +20,15 @@ class CBC_EAN8 : public CBC_OneCode {
~CBC_EAN8() override;
// CBC_OneCode:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
private:
CBC_OnedEAN8Writer* GetOnedEAN8Writer();
- CFX_WideString Preprocess(const CFX_WideStringC& contents);
- CFX_WideString m_renderContents;
+ WideString Preprocess(const WideStringView& contents);
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_EAN8_H_
diff --git a/fxbarcode/cbc_onecode.cpp b/fxbarcode/cbc_onecode.cpp
index 2d64704f7e..fb8cb05ef8 100644
--- a/fxbarcode/cbc_onecode.cpp
+++ b/fxbarcode/cbc_onecode.cpp
@@ -30,11 +30,11 @@ CBC_OneCode::CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter)
CBC_OneCode::~CBC_OneCode() {}
-bool CBC_OneCode::CheckContentValidity(const CFX_WideStringC& contents) {
+bool CBC_OneCode::CheckContentValidity(const WideStringView& contents) {
return GetOneDimWriter()->CheckContentValidity(contents);
}
-CFX_WideString CBC_OneCode::FilterContents(const CFX_WideStringC& contents) {
+WideString CBC_OneCode::FilterContents(const WideStringView& contents) {
return GetOneDimWriter()->FilterContents(contents);
}
diff --git a/fxbarcode/cbc_onecode.h b/fxbarcode/cbc_onecode.h
index e6b5b7b511..eae618ec6b 100644
--- a/fxbarcode/cbc_onecode.h
+++ b/fxbarcode/cbc_onecode.h
@@ -21,8 +21,8 @@ class CBC_OneCode : public CBC_CodeBase {
explicit CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter);
~CBC_OneCode() override;
- virtual bool CheckContentValidity(const CFX_WideStringC& contents);
- virtual CFX_WideString FilterContents(const CFX_WideStringC& contents);
+ virtual bool CheckContentValidity(const WideStringView& contents);
+ virtual WideString FilterContents(const WideStringView& contents);
virtual void SetPrintChecksum(bool checksum);
virtual void SetDataLength(int32_t length);
diff --git a/fxbarcode/cbc_pdf417i.cpp b/fxbarcode/cbc_pdf417i.cpp
index 545a7d8cbf..4e7e063a44 100644
--- a/fxbarcode/cbc_pdf417i.cpp
+++ b/fxbarcode/cbc_pdf417i.cpp
@@ -40,12 +40,12 @@ void CBC_PDF417I::SetTruncated(bool truncated) {
GetPDF417Writer()->SetTruncated(truncated);
}
-bool CBC_PDF417I::Encode(const CFX_WideStringC& contents) {
+bool CBC_PDF417I::Encode(const WideStringView& contents) {
int32_t outWidth = 0;
int32_t outHeight = 0;
auto* pWriter = GetPDF417Writer();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(CFX_WideString(contents), outWidth, outHeight));
+ pWriter->Encode(WideString(contents), outWidth, outHeight));
if (!data)
return false;
return pWriter->RenderResult(data.get(), outWidth, outHeight);
diff --git a/fxbarcode/cbc_pdf417i.h b/fxbarcode/cbc_pdf417i.h
index 73f99d3579..5bd7a26eeb 100644
--- a/fxbarcode/cbc_pdf417i.h
+++ b/fxbarcode/cbc_pdf417i.h
@@ -20,7 +20,7 @@ class CBC_PDF417I : public CBC_CodeBase {
~CBC_PDF417I() override;
// CBC_CodeBase:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
diff --git a/fxbarcode/cbc_qrcode.cpp b/fxbarcode/cbc_qrcode.cpp
index 297ce77212..0f3a65ef3a 100644
--- a/fxbarcode/cbc_qrcode.cpp
+++ b/fxbarcode/cbc_qrcode.cpp
@@ -37,13 +37,13 @@ bool CBC_QRCode::SetErrorCorrectionLevel(int32_t level) {
return GetQRCodeWriter()->SetErrorCorrectionLevel(level);
}
-bool CBC_QRCode::Encode(const CFX_WideStringC& contents) {
+bool CBC_QRCode::Encode(const WideStringView& contents) {
int32_t outWidth = 0;
int32_t outHeight = 0;
CBC_QRCodeWriter* pWriter = GetQRCodeWriter();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
- pWriter->Encode(CFX_WideString(contents),
- pWriter->GetErrorCorrectionLevel(), outWidth, outHeight));
+ pWriter->Encode(WideString(contents), pWriter->GetErrorCorrectionLevel(),
+ outWidth, outHeight));
if (!data)
return false;
return pWriter->RenderResult(data.get(), outWidth, outHeight);
diff --git a/fxbarcode/cbc_qrcode.h b/fxbarcode/cbc_qrcode.h
index 638726769c..509de8a8d8 100644
--- a/fxbarcode/cbc_qrcode.h
+++ b/fxbarcode/cbc_qrcode.h
@@ -20,7 +20,7 @@ class CBC_QRCode : public CBC_CodeBase {
~CBC_QRCode() override;
// CBC_CodeBase:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
diff --git a/fxbarcode/cbc_upca.cpp b/fxbarcode/cbc_upca.cpp
index f4c273f764..69cedce580 100644
--- a/fxbarcode/cbc_upca.cpp
+++ b/fxbarcode/cbc_upca.cpp
@@ -30,15 +30,15 @@ CBC_UPCA::CBC_UPCA() : CBC_OneCode(pdfium::MakeUnique<CBC_OnedUPCAWriter>()) {}
CBC_UPCA::~CBC_UPCA() {}
-CFX_WideString CBC_UPCA::Preprocess(const CFX_WideStringC& contents) {
+WideString CBC_UPCA::Preprocess(const WideStringView& contents) {
CBC_OnedUPCAWriter* pWriter = GetOnedUPCAWriter();
- CFX_WideString encodeContents = pWriter->FilterContents(contents);
+ WideString encodeContents = pWriter->FilterContents(contents);
int32_t length = encodeContents.GetLength();
if (length <= 11) {
for (int32_t i = 0; i < 11 - length; i++)
encodeContents = wchar_t('0') + encodeContents;
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.UTF8Encode();
int32_t checksum = pWriter->CalcChecksum(byteString);
byteString += checksum - 0 + '0';
encodeContents = byteString.UTF8Decode();
@@ -49,15 +49,15 @@ CFX_WideString CBC_UPCA::Preprocess(const CFX_WideStringC& contents) {
return encodeContents;
}
-bool CBC_UPCA::Encode(const CFX_WideStringC& contents) {
+bool CBC_UPCA::Encode(const WideStringView& contents) {
if (contents.IsEmpty())
return false;
BCFORMAT format = BCFORMAT_UPC_A;
int32_t outWidth = 0;
int32_t outHeight = 0;
- CFX_WideString encodeContents = Preprocess(contents);
- CFX_ByteString byteString = encodeContents.UTF8Encode();
+ WideString encodeContents = Preprocess(contents);
+ ByteString byteString = encodeContents.UTF8Encode();
m_renderContents = encodeContents;
CBC_OnedUPCAWriter* pWriter = GetOnedUPCAWriter();
@@ -66,14 +66,14 @@ bool CBC_UPCA::Encode(const CFX_WideStringC& contents) {
pWriter->Encode(byteString, format, outWidth, outHeight));
if (!data)
return false;
- return pWriter->RenderResult(encodeContents.AsStringC(), data.get(),
+ return pWriter->RenderResult(encodeContents.AsStringView(), data.get(),
outWidth);
}
bool CBC_UPCA::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
- return GetOnedUPCAWriter()->RenderDeviceResult(device, matrix,
- m_renderContents.AsStringC());
+ return GetOnedUPCAWriter()->RenderDeviceResult(
+ device, matrix, m_renderContents.AsStringView());
}
BC_TYPE CBC_UPCA::GetType() {
diff --git a/fxbarcode/cbc_upca.h b/fxbarcode/cbc_upca.h
index 5955230c46..29c4d7d9e6 100644
--- a/fxbarcode/cbc_upca.h
+++ b/fxbarcode/cbc_upca.h
@@ -20,15 +20,15 @@ class CBC_UPCA : public CBC_OneCode {
~CBC_UPCA() override;
// CBC_CodeBase:
- bool Encode(const CFX_WideStringC& contents) override;
+ bool Encode(const WideStringView& contents) override;
bool RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) override;
BC_TYPE GetType() override;
private:
CBC_OnedUPCAWriter* GetOnedUPCAWriter();
- CFX_WideString Preprocess(const CFX_WideStringC& contents);
- CFX_WideString m_renderContents;
+ WideString Preprocess(const WideStringView& contents);
+ WideString m_renderContents;
};
#endif // FXBARCODE_CBC_UPCA_H_
diff --git a/fxbarcode/datamatrix/BC_Base256Encoder.cpp b/fxbarcode/datamatrix/BC_Base256Encoder.cpp
index 0cbd3fdb10..b7dd69c0f7 100644
--- a/fxbarcode/datamatrix/BC_Base256Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_Base256Encoder.cpp
@@ -34,7 +34,7 @@ int32_t CBC_Base256Encoder::getEncodingMode() {
return BASE256_ENCODATION;
}
void CBC_Base256Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
+ WideString buffer;
buffer += L'\0';
while (context.hasMoreCharacters()) {
wchar_t c = context.getCurrentChar();
diff --git a/fxbarcode/datamatrix/BC_C40Encoder.cpp b/fxbarcode/datamatrix/BC_C40Encoder.cpp
index 8a55c922ed..348315e149 100644
--- a/fxbarcode/datamatrix/BC_C40Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_C40Encoder.cpp
@@ -31,7 +31,7 @@
namespace {
-CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) {
+WideString EncodeToCodewords(const WideString& sb, int32_t startPos) {
wchar_t c1 = sb[startPos];
wchar_t c2 = sb[startPos + 1];
wchar_t c3 = sb[startPos + 2];
@@ -39,7 +39,7 @@ CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) {
wchar_t cw[2];
cw[0] = static_cast<wchar_t>(v / 256);
cw[1] = static_cast<wchar_t>(v % 256);
- return CFX_WideString(cw, FX_ArraySize(cw));
+ return WideString(cw, FX_ArraySize(cw));
}
} // namespace
@@ -50,7 +50,7 @@ int32_t CBC_C40Encoder::getEncodingMode() {
return C40_ENCODATION;
}
void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
+ WideString buffer;
while (context.hasMoreCharacters()) {
wchar_t c = context.getCurrentChar();
context.m_pos++;
@@ -98,12 +98,12 @@ void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
handleEOD(context, buffer, e);
}
void CBC_C40Encoder::writeNextTriplet(CBC_EncoderContext& context,
- CFX_WideString& buffer) {
+ WideString& buffer) {
context.writeCodewords(EncodeToCodewords(buffer, 0));
buffer.Delete(0, 3);
}
void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
+ WideString& buffer,
int32_t& e) {
int32_t unwritten = (buffer.GetLength() / 3) * 2;
int32_t rest = buffer.GetLength() % 3;
@@ -142,7 +142,7 @@ void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context,
}
context.signalEncoderChange(ASCII_ENCODATION);
}
-int32_t CBC_C40Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+int32_t CBC_C40Encoder::encodeChar(wchar_t c, WideString& sb, int32_t& e) {
if (c == ' ') {
sb += (wchar_t)'\3';
return 1;
@@ -187,7 +187,7 @@ int32_t CBC_C40Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
}
int32_t CBC_C40Encoder::BacktrackOneCharacter(CBC_EncoderContext* context,
- CFX_WideString* buffer,
+ WideString* buffer,
int32_t lastCharSize) {
if (context->m_pos < 1)
return -1;
@@ -200,7 +200,7 @@ int32_t CBC_C40Encoder::BacktrackOneCharacter(CBC_EncoderContext* context,
context->m_pos--;
wchar_t c = context->getCurrentChar();
int32_t e = BCExceptionNO;
- CFX_WideString removed;
+ WideString removed;
int32_t len = encodeChar(c, removed, e);
if (e != BCExceptionNO)
return -1;
diff --git a/fxbarcode/datamatrix/BC_C40Encoder.h b/fxbarcode/datamatrix/BC_C40Encoder.h
index 550d226efb..5ddad92009 100644
--- a/fxbarcode/datamatrix/BC_C40Encoder.h
+++ b/fxbarcode/datamatrix/BC_C40Encoder.h
@@ -7,10 +7,9 @@
#ifndef FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
#define FXBARCODE_DATAMATRIX_BC_C40ENCODER_H_
+#include "core/fxcrt/widestring.h"
#include "fxbarcode/datamatrix/BC_Encoder.h"
-class CFX_WideString;
-
class CBC_C40Encoder : public CBC_Encoder {
public:
CBC_C40Encoder();
@@ -20,13 +19,12 @@ class CBC_C40Encoder : public CBC_Encoder {
int32_t getEncodingMode() override;
void Encode(CBC_EncoderContext& context, int32_t& e) override;
- static void writeNextTriplet(CBC_EncoderContext& context,
- CFX_WideString& buffer);
+ static void writeNextTriplet(CBC_EncoderContext& context, WideString& buffer);
virtual void handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
+ WideString& buffer,
int32_t& e);
- virtual int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e);
+ virtual int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e);
private:
// Moves back by 1 position in |context| and adjusts |buffer| accordingly
@@ -34,7 +32,7 @@ class CBC_C40Encoder : public CBC_Encoder {
// |context| after adjusting the position. If the character cannot be encoded,
// return -1.
int32_t BacktrackOneCharacter(CBC_EncoderContext* context,
- CFX_WideString* buffer,
+ WideString* buffer,
int32_t lastCharSize);
};
diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
index 98af282f8f..d4f9ad3479 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
+++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
@@ -108,15 +108,15 @@ bool CBC_DataMatrixWriter::SetErrorCorrectionLevel(int32_t level) {
return true;
}
-uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents,
+uint8_t* CBC_DataMatrixWriter::Encode(const WideString& contents,
int32_t& outWidth,
int32_t& outHeight) {
if (outWidth < 0 || outHeight < 0)
return nullptr;
- CFX_WideString ecLevel;
+ WideString ecLevel;
int32_t e = BCExceptionNO;
- CFX_WideString encoded =
+ WideString encoded =
CBC_HighLevelEncoder::encodeHighLevel(contents, ecLevel, false, e);
if (e != BCExceptionNO)
return nullptr;
@@ -124,7 +124,7 @@ uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents,
CBC_SymbolInfo::lookup(encoded.GetLength(), false, e);
if (e != BCExceptionNO)
return nullptr;
- CFX_WideString codewords =
+ WideString codewords =
CBC_ErrorCorrection::encodeECC200(encoded, symbolInfo, e);
if (e != BCExceptionNO)
return nullptr;
diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.h b/fxbarcode/datamatrix/BC_DataMatrixWriter.h
index 84b83fe7a3..ba2c54762e 100644
--- a/fxbarcode/datamatrix/BC_DataMatrixWriter.h
+++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.h
@@ -18,7 +18,7 @@ class CBC_DataMatrixWriter : public CBC_TwoDimWriter {
CBC_DataMatrixWriter();
~CBC_DataMatrixWriter() override;
- uint8_t* Encode(const CFX_WideString& contents,
+ uint8_t* Encode(const WideString& contents,
int32_t& outWidth,
int32_t& outHeight);
diff --git a/fxbarcode/datamatrix/BC_DefaultPlacement.cpp b/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
index 934d79503c..3f1b35864f 100644
--- a/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
+++ b/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
@@ -23,7 +23,7 @@
#include "fxbarcode/datamatrix/BC_DefaultPlacement.h"
#include "fxbarcode/datamatrix/BC_Encoder.h"
-CBC_DefaultPlacement::CBC_DefaultPlacement(CFX_WideString codewords,
+CBC_DefaultPlacement::CBC_DefaultPlacement(WideString codewords,
int32_t numcols,
int32_t numrows) {
m_codewords = codewords;
diff --git a/fxbarcode/datamatrix/BC_DefaultPlacement.h b/fxbarcode/datamatrix/BC_DefaultPlacement.h
index 17ecac9f5c..12ea852136 100644
--- a/fxbarcode/datamatrix/BC_DefaultPlacement.h
+++ b/fxbarcode/datamatrix/BC_DefaultPlacement.h
@@ -13,9 +13,7 @@
class CBC_DefaultPlacement {
public:
- CBC_DefaultPlacement(CFX_WideString codewords,
- int32_t numcols,
- int32_t numrows);
+ CBC_DefaultPlacement(WideString codewords, int32_t numcols, int32_t numrows);
virtual ~CBC_DefaultPlacement();
int32_t getNumrows();
@@ -27,7 +25,7 @@ class CBC_DefaultPlacement {
void place();
private:
- CFX_WideString m_codewords;
+ WideString m_codewords;
int32_t m_numrows;
int32_t m_numcols;
std::vector<uint8_t> m_bits;
diff --git a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
index 7407efb47e..438c87a38f 100644
--- a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
@@ -33,10 +33,10 @@
namespace {
-CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) {
+WideString EncodeToCodewords(const WideString& sb, int32_t startPos) {
int32_t len = sb.GetLength() - startPos;
if (len == 0)
- return CFX_WideString();
+ return WideString();
wchar_t c1 = sb[startPos];
wchar_t c2 = len >= 2 ? sb[startPos + 1] : 0;
@@ -48,10 +48,10 @@ CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) {
cw[0] = static_cast<wchar_t>((v >> 16) & 255);
cw[1] = static_cast<wchar_t>((v >> 8) & 255);
cw[2] = static_cast<wchar_t>(v & 255);
- return CFX_WideString(cw, std::min(len, kBuflen));
+ return WideString(cw, std::min(len, kBuflen));
}
-bool HandleEOD(CBC_EncoderContext* context, const CFX_WideString& buffer) {
+bool HandleEOD(CBC_EncoderContext* context, const WideString& buffer) {
int32_t count = buffer.GetLength();
if (count == 0)
return true;
@@ -72,7 +72,7 @@ bool HandleEOD(CBC_EncoderContext* context, const CFX_WideString& buffer) {
}
int32_t restChars = count - 1;
- CFX_WideString encoded = EncodeToCodewords(buffer, 0);
+ WideString encoded = EncodeToCodewords(buffer, 0);
if (encoded.IsEmpty())
return false;
@@ -105,7 +105,7 @@ bool HandleEOD(CBC_EncoderContext* context, const CFX_WideString& buffer) {
return true;
}
-void encodeChar(wchar_t c, CFX_WideString* sb, int32_t& e) {
+void encodeChar(wchar_t c, WideString* sb, int32_t& e) {
if (c >= ' ' && c <= '?') {
*sb += c;
} else if (c >= '@' && c <= '^') {
@@ -126,7 +126,7 @@ int32_t CBC_EdifactEncoder::getEncodingMode() {
}
void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
+ WideString buffer;
while (context.hasMoreCharacters()) {
wchar_t c = context.getCurrentChar();
encodeChar(c, &buffer, e);
@@ -136,7 +136,7 @@ void CBC_EdifactEncoder::Encode(CBC_EncoderContext& context, int32_t& e) {
context.m_pos++;
int32_t count = buffer.GetLength();
if (count >= 4) {
- CFX_WideString encoded = EncodeToCodewords(buffer, 0);
+ WideString encoded = EncodeToCodewords(buffer, 0);
if (encoded.IsEmpty()) {
e = BCExceptionGeneric;
return;
diff --git a/fxbarcode/datamatrix/BC_EncoderContext.cpp b/fxbarcode/datamatrix/BC_EncoderContext.cpp
index eaf3768f49..6e1671035a 100644
--- a/fxbarcode/datamatrix/BC_EncoderContext.cpp
+++ b/fxbarcode/datamatrix/BC_EncoderContext.cpp
@@ -28,12 +28,12 @@
#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
#include "fxbarcode/utils.h"
-CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString& msg,
- const CFX_WideString& ecLevel,
+CBC_EncoderContext::CBC_EncoderContext(const WideString& msg,
+ const WideString& ecLevel,
int32_t& e) {
- CFX_ByteString dststr;
+ ByteString dststr;
CBC_UtilCodingConvert::UnicodeToUTF8(msg, dststr);
- CFX_WideString sb;
+ WideString sb;
FX_STRSIZE c = dststr.GetLength();
for (FX_STRSIZE i = 0; i < c; i++) {
wchar_t ch = static_cast<wchar_t>(dststr[i] & 0xff);
@@ -66,7 +66,7 @@ wchar_t CBC_EncoderContext::getCurrent() {
return m_msg[m_pos];
}
-void CBC_EncoderContext::writeCodewords(const CFX_WideString& codewords) {
+void CBC_EncoderContext::writeCodewords(const WideString& codewords) {
m_codewords += codewords;
}
diff --git a/fxbarcode/datamatrix/BC_EncoderContext.h b/fxbarcode/datamatrix/BC_EncoderContext.h
index ef4c38ebab..1289a45e68 100644
--- a/fxbarcode/datamatrix/BC_EncoderContext.h
+++ b/fxbarcode/datamatrix/BC_EncoderContext.h
@@ -8,14 +8,14 @@
#define FXBARCODE_DATAMATRIX_BC_ENCODERCONTEXT_H_
#include "core/fxcrt/cfx_unowned_ptr.h"
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/widestring.h"
class CBC_SymbolInfo;
class CBC_EncoderContext {
public:
- CBC_EncoderContext(const CFX_WideString& msg,
- const CFX_WideString& ecLevel,
+ CBC_EncoderContext(const WideString& msg,
+ const WideString& ecLevel,
int32_t& e);
~CBC_EncoderContext();
@@ -23,7 +23,7 @@ class CBC_EncoderContext {
void setSkipAtEnd(int32_t count);
wchar_t getCurrentChar();
wchar_t getCurrent();
- void writeCodewords(const CFX_WideString& codewords);
+ void writeCodewords(const WideString& codewords);
void writeCodeword(wchar_t codeword);
FX_STRSIZE getCodewordCount();
void signalEncoderChange(int32_t encoding);
@@ -34,8 +34,8 @@ class CBC_EncoderContext {
void updateSymbolInfo(int32_t len, int32_t& e);
void resetSymbolInfo();
- CFX_WideString m_msg;
- CFX_WideString m_codewords;
+ WideString m_msg;
+ WideString m_codewords;
FX_STRSIZE m_pos;
int32_t m_newEncoding;
CFX_UnownedPtr<CBC_SymbolInfo> m_symbolInfo;
diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index c45eadcf9a..35077ee628 100644
--- a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -119,22 +119,21 @@ void CBC_ErrorCorrection::Initialize() {
void CBC_ErrorCorrection::Finalize() {}
CBC_ErrorCorrection::CBC_ErrorCorrection() {}
CBC_ErrorCorrection::~CBC_ErrorCorrection() {}
-CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
- CBC_SymbolInfo* symbolInfo,
- int32_t& e) {
+WideString CBC_ErrorCorrection::encodeECC200(WideString codewords,
+ CBC_SymbolInfo* symbolInfo,
+ int32_t& e) {
if (pdfium::base::checked_cast<int32_t>(codewords.GetLength()) !=
symbolInfo->dataCapacity()) {
e = BCExceptionIllegalArgument;
- return CFX_WideString();
+ return WideString();
}
- CFX_WideString sb;
+ WideString sb;
sb += codewords;
int32_t blockCount = symbolInfo->getInterleavedBlockCount();
if (blockCount == 1) {
- CFX_WideString ecc =
- createECCBlock(codewords, symbolInfo->errorCodewords(), e);
+ WideString ecc = createECCBlock(codewords, symbolInfo->errorCodewords(), e);
if (e != BCExceptionNO)
- return CFX_WideString();
+ return WideString();
sb += ecc;
} else {
std::vector<int32_t> dataSizes(blockCount);
@@ -149,13 +148,13 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
}
}
for (int32_t block = 0; block < blockCount; block++) {
- CFX_WideString temp;
+ WideString temp;
for (int32_t d = block; d < symbolInfo->dataCapacity(); d += blockCount) {
temp += (wchar_t)codewords[d];
}
- CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e);
+ WideString ecc = createECCBlock(temp, errorSizes[block], e);
if (e != BCExceptionNO)
- return CFX_WideString();
+ return WideString();
int32_t pos = 0;
for (int32_t l = block; l < errorSizes[block] * blockCount;
l += blockCount) {
@@ -165,16 +164,16 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
}
return sb;
}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
- int32_t numECWords,
- int32_t& e) {
+WideString CBC_ErrorCorrection::createECCBlock(WideString codewords,
+ int32_t numECWords,
+ int32_t& e) {
return createECCBlock(codewords, 0, codewords.GetLength(), numECWords, e);
}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
- int32_t start,
- int32_t len,
- int32_t numECWords,
- int32_t& e) {
+WideString CBC_ErrorCorrection::createECCBlock(WideString codewords,
+ int32_t start,
+ int32_t len,
+ int32_t numECWords,
+ int32_t& e) {
static const size_t kFactorTableNum = sizeof(FACTOR_SETS) / sizeof(int32_t);
size_t table = 0;
while (table < kFactorTableNum && FACTOR_SETS[table] != numECWords)
@@ -182,7 +181,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
if (table >= kFactorTableNum) {
e = BCExceptionIllegalArgument;
- return CFX_WideString();
+ return WideString();
}
uint16_t* ecc = FX_Alloc(uint16_t, numECWords);
memset(ecc, 0, numECWords * sizeof(uint16_t));
@@ -202,7 +201,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
ecc[0] = 0;
}
}
- CFX_WideString strecc;
+ WideString strecc;
for (int32_t j = 0; j < numECWords; j++) {
strecc += (wchar_t)ecc[numECWords - j - 1];
}
diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.h b/fxbarcode/datamatrix/BC_ErrorCorrection.h
index 97a2e48e2d..361b205ef4 100644
--- a/fxbarcode/datamatrix/BC_ErrorCorrection.h
+++ b/fxbarcode/datamatrix/BC_ErrorCorrection.h
@@ -7,7 +7,7 @@
#ifndef FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
#define FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/widestring.h"
class CBC_SymbolInfo;
@@ -18,9 +18,9 @@ class CBC_ErrorCorrection {
static void Initialize();
static void Finalize();
- static CFX_WideString encodeECC200(CFX_WideString codewords,
- CBC_SymbolInfo* symbolInfo,
- int32_t& e);
+ static WideString encodeECC200(WideString codewords,
+ CBC_SymbolInfo* symbolInfo,
+ int32_t& e);
private:
static int32_t MODULO_VALUE;
@@ -28,14 +28,14 @@ class CBC_ErrorCorrection {
static int32_t ALOG[256];
private:
- static CFX_WideString createECCBlock(CFX_WideString codewords,
- int32_t numECWords,
- int32_t& e);
- static CFX_WideString createECCBlock(CFX_WideString codewords,
- int32_t start,
- int32_t len,
- int32_t numECWords,
- int32_t& e);
+ static WideString createECCBlock(WideString codewords,
+ int32_t numECWords,
+ int32_t& e);
+ static WideString createECCBlock(WideString codewords,
+ int32_t start,
+ int32_t len,
+ int32_t numECWords,
+ int32_t& e);
};
#endif // FXBARCODE_DATAMATRIX_BC_ERRORCORRECTION_H_
diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index b8c63946db..56a8847066 100644
--- a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -58,22 +58,21 @@ const wchar_t CBC_HighLevelEncoder::MACRO_TRAILER = 0x0004;
CBC_HighLevelEncoder::CBC_HighLevelEncoder() {}
CBC_HighLevelEncoder::~CBC_HighLevelEncoder() {}
-std::vector<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage(
- CFX_WideString msg) {
- CFX_ByteString bytestr;
+std::vector<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage(WideString msg) {
+ ByteString bytestr;
CBC_UtilCodingConvert::UnicodeToUTF8(msg, bytestr);
m_bytearray.insert(m_bytearray.end(), bytestr.begin(), bytestr.end());
return m_bytearray;
}
// static
-CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
- CFX_WideString ecLevel,
- bool allowRectangular,
- int32_t& e) {
+WideString CBC_HighLevelEncoder::encodeHighLevel(WideString msg,
+ WideString ecLevel,
+ bool allowRectangular,
+ int32_t& e) {
CBC_EncoderContext context(msg, ecLevel, e);
if (e != BCExceptionNO)
- return CFX_WideString();
+ return WideString();
context.setAllowRectangular(allowRectangular);
if ((msg.Left(6) == MACRO_05_HEADER) && (msg.Last() == MACRO_TRAILER)) {
@@ -117,7 +116,7 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
context.writeCodeword(0x00fe);
}
}
- CFX_WideString codewords = context.m_codewords;
+ WideString codewords = context.m_codewords;
if (pdfium::base::checked_cast<int32_t>(codewords.GetLength()) < capacity) {
codewords += PAD;
}
@@ -128,7 +127,7 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
}
return codewords;
}
-int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg,
+int32_t CBC_HighLevelEncoder::lookAheadTest(WideString msg,
int32_t startpos,
int32_t currentMode) {
if (startpos >= pdfium::base::checked_cast<int32_t>(msg.GetLength())) {
@@ -279,7 +278,7 @@ bool CBC_HighLevelEncoder::isDigit(wchar_t ch) {
bool CBC_HighLevelEncoder::isExtendedASCII(wchar_t ch) {
return ch >= 128 && ch <= 255;
}
-int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg,
+int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(WideString msg,
int32_t startpos) {
int32_t count = 0;
int32_t len = msg.GetLength();
diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/fxbarcode/datamatrix/BC_HighLevelEncoder.h
index 0b7ff9bf0e..50cfc8c592 100644
--- a/fxbarcode/datamatrix/BC_HighLevelEncoder.h
+++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.h
@@ -9,7 +9,7 @@
#include <vector>
-#include "core/fxcrt/cfx_widestring.h"
+#include "core/fxcrt/widestring.h"
#define ASCII_ENCODATION 0
#define C40_ENCODATION 1
@@ -23,18 +23,18 @@ class CBC_HighLevelEncoder {
CBC_HighLevelEncoder();
~CBC_HighLevelEncoder();
- std::vector<uint8_t>& getBytesForMessage(CFX_WideString msg);
+ std::vector<uint8_t>& getBytesForMessage(WideString msg);
- static CFX_WideString encodeHighLevel(CFX_WideString msg,
- CFX_WideString ecLevel,
- bool allowRectangular,
- int32_t& e);
- static int32_t lookAheadTest(CFX_WideString msg,
+ static WideString encodeHighLevel(WideString msg,
+ WideString ecLevel,
+ bool allowRectangular,
+ int32_t& e);
+ static int32_t lookAheadTest(WideString msg,
int32_t startpos,
int32_t currentMode);
static bool isDigit(wchar_t ch);
static bool isExtendedASCII(wchar_t ch);
- static int32_t determineConsecutiveDigitCount(CFX_WideString msg,
+ static int32_t determineConsecutiveDigitCount(WideString msg,
int32_t startpos);
static const wchar_t LATCH_TO_C40;
diff --git a/fxbarcode/datamatrix/BC_TextEncoder.cpp b/fxbarcode/datamatrix/BC_TextEncoder.cpp
index 451c7b84d1..a78310ed21 100644
--- a/fxbarcode/datamatrix/BC_TextEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_TextEncoder.cpp
@@ -33,7 +33,7 @@ CBC_TextEncoder::~CBC_TextEncoder() {}
int32_t CBC_TextEncoder::getEncodingMode() {
return TEXT_ENCODATION;
}
-int32_t CBC_TextEncoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+int32_t CBC_TextEncoder::encodeChar(wchar_t c, WideString& sb, int32_t& e) {
if (c == ' ') {
sb += (wchar_t)'\3';
return 1;
diff --git a/fxbarcode/datamatrix/BC_TextEncoder.h b/fxbarcode/datamatrix/BC_TextEncoder.h
index c4ba3c3e09..9d4cdafe10 100644
--- a/fxbarcode/datamatrix/BC_TextEncoder.h
+++ b/fxbarcode/datamatrix/BC_TextEncoder.h
@@ -16,7 +16,7 @@ class CBC_TextEncoder : public CBC_C40Encoder {
// CBC_C40Encoder
int32_t getEncodingMode() override;
- int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override;
+ int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e) override;
};
#endif // FXBARCODE_DATAMATRIX_BC_TEXTENCODER_H_
diff --git a/fxbarcode/datamatrix/BC_X12Encoder.cpp b/fxbarcode/datamatrix/BC_X12Encoder.cpp
index 625ff90290..a080a71eac 100644
--- a/fxbarcode/datamatrix/BC_X12Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_X12Encoder.cpp
@@ -36,7 +36,7 @@ int32_t CBC_X12Encoder::getEncodingMode() {
return X12_ENCODATION;
}
void CBC_X12Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
- CFX_WideString buffer;
+ WideString buffer;
while (context.hasMoreCharacters()) {
wchar_t c = context.getCurrentChar();
context.m_pos++;
@@ -58,7 +58,7 @@ void CBC_X12Encoder::Encode(CBC_EncoderContext& context, int32_t& e) {
handleEOD(context, buffer, e);
}
void CBC_X12Encoder::handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
+ WideString& buffer,
int32_t& e) {
context.updateSymbolInfo(e);
if (e != BCExceptionNO) {
@@ -79,7 +79,7 @@ void CBC_X12Encoder::handleEOD(CBC_EncoderContext& context,
context.signalEncoderChange(ASCII_ENCODATION);
}
}
-int32_t CBC_X12Encoder::encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) {
+int32_t CBC_X12Encoder::encodeChar(wchar_t c, WideString& sb, int32_t& e) {
if (c == '\r') {
sb += (wchar_t)'\0';
} else if (c == '*') {
diff --git a/fxbarcode/datamatrix/BC_X12Encoder.h b/fxbarcode/datamatrix/BC_X12Encoder.h
index 146f739f84..324b78bdcc 100644
--- a/fxbarcode/datamatrix/BC_X12Encoder.h
+++ b/fxbarcode/datamatrix/BC_X12Encoder.h
@@ -18,9 +18,9 @@ class CBC_X12Encoder : public CBC_C40Encoder {
int32_t getEncodingMode() override;
void Encode(CBC_EncoderContext& context, int32_t& e) override;
void handleEOD(CBC_EncoderContext& context,
- CFX_WideString& buffer,
+ WideString& buffer,
int32_t& e) override;
- int32_t encodeChar(wchar_t c, CFX_WideString& sb, int32_t& e) override;
+ int32_t encodeChar(wchar_t c, WideString& sb, int32_t& e) override;
};
#endif // FXBARCODE_DATAMATRIX_BC_X12ENCODER_H_
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 1f96c4575b..e09e0ce5aa 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -89,7 +89,7 @@ wchar_t CBC_OneDimWriter::Upper(wchar_t ch) {
return ch;
}
-uint8_t* CBC_OneDimWriter::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OneDimWriter::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -98,7 +98,7 @@ uint8_t* CBC_OneDimWriter::EncodeWithHint(const CFX_ByteString& contents,
return EncodeImpl(contents, outWidth);
}
-uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents,
+uint8_t* CBC_OneDimWriter::Encode(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight) {
@@ -127,7 +127,7 @@ int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target,
return numAdded;
}
-void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text,
+void CBC_OneDimWriter::CalcTextInfo(const ByteString& text,
FXTEXT_CHARPOS* charPos,
CFX_Font* cFont,
float geWidth,
@@ -176,7 +176,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text,
void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
- const CFX_ByteString str,
+ const ByteString str,
float geWidth,
FXTEXT_CHARPOS* pCharPos,
float locX,
@@ -201,7 +201,7 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
m_fontColor, FXTEXT_CLEARTYPE);
}
-bool CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
+bool CBC_OneDimWriter::ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
@@ -209,7 +209,7 @@ bool CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
if (!device || !m_pFont)
return false;
- CFX_ByteString str = FX_UTF8Encode(contents);
+ ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
std::vector<FXTEXT_CHARPOS> charpos(iLen);
float charsLen = 0;
@@ -260,7 +260,7 @@ bool CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
bool CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
- const CFX_WideStringC& contents) {
+ const WideStringView& contents) {
if (m_output.empty())
return false;
@@ -283,7 +283,7 @@ bool CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
ShowChars(contents, device, matrix, m_barWidth, m_multiple);
}
-bool CBC_OneDimWriter::RenderResult(const CFX_WideStringC& contents,
+bool CBC_OneDimWriter::RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) {
if (codeLength < 1)
@@ -338,7 +338,7 @@ void CBC_OneDimWriter::RenderVerticalBars(int32_t outputX,
}
}
-CFX_WideString CBC_OneDimWriter::RenderTextContents(
- const CFX_WideStringC& contents) {
- return CFX_WideString();
+WideString CBC_OneDimWriter::RenderTextContents(
+ const WideStringView& contents) {
+ return WideString();
}
diff --git a/fxbarcode/oned/BC_OneDimWriter.h b/fxbarcode/oned/BC_OneDimWriter.h
index 2d604b5b51..880f60f0b8 100644
--- a/fxbarcode/oned/BC_OneDimWriter.h
+++ b/fxbarcode/oned/BC_OneDimWriter.h
@@ -24,12 +24,12 @@ class CBC_OneDimWriter : public CBC_Writer {
CBC_OneDimWriter();
~CBC_OneDimWriter() override;
- virtual bool RenderResult(const CFX_WideStringC& contents,
+ virtual bool RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength);
- virtual bool CheckContentValidity(const CFX_WideStringC& contents) = 0;
- virtual CFX_WideString FilterContents(const CFX_WideStringC& contents) = 0;
- virtual CFX_WideString RenderTextContents(const CFX_WideStringC& contents);
+ virtual bool CheckContentValidity(const WideStringView& contents) = 0;
+ virtual WideString FilterContents(const WideStringView& contents) = 0;
+ virtual WideString RenderTextContents(const WideStringView& contents);
virtual void SetPrintChecksum(bool checksum);
virtual void SetDataLength(int32_t length);
virtual void SetCalcChecksum(bool state);
@@ -37,37 +37,37 @@ class CBC_OneDimWriter : public CBC_Writer {
virtual void SetFontStyle(int32_t style);
virtual void SetFontColor(FX_ARGB color);
- uint8_t* Encode(const CFX_ByteString& contents,
+ uint8_t* Encode(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight);
bool RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
- const CFX_WideStringC& contents);
+ const WideStringView& contents);
bool SetFont(CFX_Font* cFont);
protected:
- virtual uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ virtual uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints);
- virtual uint8_t* EncodeImpl(const CFX_ByteString& contents,
+ virtual uint8_t* EncodeImpl(const ByteString& contents,
int32_t& outLength) = 0;
- virtual void CalcTextInfo(const CFX_ByteString& text,
+ virtual void CalcTextInfo(const ByteString& text,
FXTEXT_CHARPOS* charPos,
CFX_Font* cFont,
float geWidth,
int32_t fontSize,
float& charsLen);
- virtual bool ShowChars(const CFX_WideStringC& contents,
+ virtual bool ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple);
virtual void ShowDeviceChars(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
- const CFX_ByteString str,
+ const ByteString str,
float geWidth,
FXTEXT_CHARPOS* pCharPos,
float locX,
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
index 03a733a8c2..4c5ad67194 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
@@ -95,15 +95,15 @@ bool CBC_OnedCodaBarWriter::FindChar(wchar_t ch, bool isContent) {
}
bool CBC_OnedCodaBarWriter::CheckContentValidity(
- const CFX_WideStringC& contents) {
+ const WideStringView& contents) {
return std::all_of(
contents.begin(), contents.end(),
[this](const wchar_t& ch) { return this->FindChar(ch, false); });
}
-CFX_WideString CBC_OnedCodaBarWriter::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedCodaBarWriter::FilterContents(
+ const WideStringView& contents) {
+ WideString filtercontents;
wchar_t ch;
for (FX_STRSIZE index = 0; index < contents.GetLength(); index++) {
ch = contents[index];
@@ -118,7 +118,7 @@ CFX_WideString CBC_OnedCodaBarWriter::FilterContents(
return filtercontents;
}
-uint8_t* CBC_OnedCodaBarWriter::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCodaBarWriter::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -129,9 +129,9 @@ uint8_t* CBC_OnedCodaBarWriter::EncodeWithHint(const CFX_ByteString& contents,
hints);
}
-uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
- CFX_ByteString data = m_chStart + contents + m_chEnd;
+ ByteString data = m_chStart + contents + m_chEnd;
m_iContentLen = data.GetLength();
uint8_t* result = FX_Alloc2D(uint8_t, m_iWideNarrRatio * 7, data.GetLength());
char ch;
@@ -188,16 +188,16 @@ uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const CFX_ByteString& contents,
return result;
}
-CFX_WideString CBC_OnedCodaBarWriter::encodedContents(
- const CFX_WideStringC& contents) {
- CFX_WideString strStart(static_cast<wchar_t>(m_chStart));
- CFX_WideString strEnd(static_cast<wchar_t>(m_chEnd));
+WideString CBC_OnedCodaBarWriter::encodedContents(
+ const WideStringView& contents) {
+ WideString strStart(static_cast<wchar_t>(m_chStart));
+ WideString strEnd(static_cast<wchar_t>(m_chEnd));
return strStart + contents + strEnd;
}
-bool CBC_OnedCodaBarWriter::RenderResult(const CFX_WideStringC& contents,
+bool CBC_OnedCodaBarWriter::RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) {
- return CBC_OneDimWriter::RenderResult(encodedContents(contents).AsStringC(),
- code, codeLength);
+ return CBC_OneDimWriter::RenderResult(
+ encodedContents(contents).AsStringView(), code, codeLength);
}
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.h b/fxbarcode/oned/BC_OnedCodaBarWriter.h
index 6a5f315073..ab354ef0a7 100644
--- a/fxbarcode/oned/BC_OnedCodaBarWriter.h
+++ b/fxbarcode/oned/BC_OnedCodaBarWriter.h
@@ -18,18 +18,17 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter {
~CBC_OnedCodaBarWriter() override;
// CBC_OneDimWriter
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- bool RenderResult(const CFX_WideStringC& contents,
+ bool RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
void SetDataLength(int32_t length) override;
virtual bool SetStartChar(char start);
@@ -38,7 +37,7 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter {
virtual bool SetWideNarrowRatio(int8_t ratio);
virtual bool FindChar(wchar_t ch, bool isContent);
- CFX_WideString encodedContents(const CFX_WideStringC& contents);
+ WideString encodedContents(const WideStringView& contents);
private:
char m_chStart;
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.cpp b/fxbarcode/oned/BC_OnedCode128Writer.cpp
index 1e9f98b9e7..61ec77b020 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode128Writer.cpp
@@ -84,7 +84,7 @@ CBC_OnedCode128Writer::CBC_OnedCode128Writer(BC_TYPE type)
CBC_OnedCode128Writer::~CBC_OnedCode128Writer() {}
bool CBC_OnedCode128Writer::CheckContentValidity(
- const CFX_WideStringC& contents) {
+ const WideStringView& contents) {
for (const auto& ch : contents) {
int32_t patternIndex = static_cast<int32_t>(ch);
if (patternIndex < 32 || patternIndex > 126 || patternIndex == 34)
@@ -93,9 +93,9 @@ bool CBC_OnedCode128Writer::CheckContentValidity(
return true;
}
-CFX_WideString CBC_OnedCode128Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filterChineseChar;
+WideString CBC_OnedCode128Writer::FilterContents(
+ const WideStringView& contents) {
+ WideString filterChineseChar;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
wchar_t ch = contents[i];
if (ch > 175) {
@@ -105,7 +105,7 @@ CFX_WideString CBC_OnedCode128Writer::FilterContents(
filterChineseChar += ch;
}
const wchar_t limit = m_codeFormat == BC_CODE128_B ? 126 : 106;
- CFX_WideString filtercontents;
+ WideString filtercontents;
for (const auto& ch : filterChineseChar) {
if (ch >= 32 && ch <= limit)
filtercontents += ch;
@@ -121,7 +121,7 @@ bool CBC_OnedCode128Writer::SetTextLocation(BC_TEXT_LOC location) {
return true;
}
-uint8_t* CBC_OnedCode128Writer::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCode128Writer::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -132,7 +132,7 @@ uint8_t* CBC_OnedCode128Writer::EncodeWithHint(const CFX_ByteString& contents,
hints);
}
-uint8_t* CBC_OnedCode128Writer::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCode128Writer::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
if (contents.GetLength() < 1 || contents.GetLength() > 80)
return nullptr;
@@ -168,7 +168,7 @@ uint8_t* CBC_OnedCode128Writer::EncodeImpl(const CFX_ByteString& contents,
}
// static
-int32_t CBC_OnedCode128Writer::Encode128B(const CFX_ByteString& contents,
+int32_t CBC_OnedCode128Writer::Encode128B(const ByteString& contents,
std::vector<int32_t>* patterns) {
int32_t checkWeight = 1;
patterns->push_back(CODE_START_B);
@@ -182,7 +182,7 @@ int32_t CBC_OnedCode128Writer::Encode128B(const CFX_ByteString& contents,
}
// static
-int32_t CBC_OnedCode128Writer::Encode128C(const CFX_ByteString& contents,
+int32_t CBC_OnedCode128Writer::Encode128C(const ByteString& contents,
std::vector<int32_t>* patterns) {
int32_t checkWeight = 1;
patterns->push_back(CODE_START_C);
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.h b/fxbarcode/oned/BC_OnedCode128Writer.h
index a80ac647f0..3edb65a72a 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.h
+++ b/fxbarcode/oned/BC_OnedCode128Writer.h
@@ -19,21 +19,20 @@ class CBC_OnedCode128Writer : public CBC_OneDimWriter {
~CBC_OnedCode128Writer() override;
// Exposed for testing.
- static int32_t Encode128B(const CFX_ByteString& contents,
+ static int32_t Encode128B(const ByteString& contents,
std::vector<int32_t>* patterns);
- static int32_t Encode128C(const CFX_ByteString& contents,
+ static int32_t Encode128C(const ByteString& contents,
std::vector<int32_t>* patterns);
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
bool SetTextLocation(BC_TEXT_LOC location);
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp
index 72d7dc4df8..2e02e01583 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp
@@ -48,7 +48,7 @@ CBC_OnedCode39Writer::CBC_OnedCode39Writer() : m_iWideNarrRatio(3) {}
CBC_OnedCode39Writer::~CBC_OnedCode39Writer() {}
bool CBC_OnedCode39Writer::CheckContentValidity(
- const CFX_WideStringC& contents) {
+ const WideStringView& contents) {
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
wchar_t ch = contents[i];
if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') ||
@@ -61,9 +61,9 @@ bool CBC_OnedCode39Writer::CheckContentValidity(
return true;
}
-CFX_WideString CBC_OnedCode39Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedCode39Writer::FilterContents(
+ const WideStringView& contents) {
+ WideString filtercontents;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
wchar_t ch = contents[i];
if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) {
@@ -84,9 +84,9 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents(
return filtercontents;
}
-CFX_WideString CBC_OnedCode39Writer::RenderTextContents(
- const CFX_WideStringC& contents) {
- CFX_WideString renderContents;
+WideString CBC_OnedCode39Writer::RenderTextContents(
+ const WideStringView& contents) {
+ WideString renderContents;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
wchar_t ch = contents[i];
if (ch == L'*' && (i == 0 || i == contents.GetLength() - 1)) {
@@ -120,7 +120,7 @@ bool CBC_OnedCode39Writer::SetWideNarrowRatio(int8_t ratio) {
return true;
}
-uint8_t* CBC_OnedCode39Writer::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCode39Writer::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -137,7 +137,7 @@ void CBC_OnedCode39Writer::ToIntArray(int32_t a, int8_t* toReturn) {
}
}
-char CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents) {
+char CBC_OnedCode39Writer::CalcCheckSum(const ByteString& contents) {
FX_STRSIZE length = contents.GetLength();
if (length > 80)
return '*';
@@ -160,7 +160,7 @@ char CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString& contents) {
return CHECKSUM_STRING[checksum];
}
-uint8_t* CBC_OnedCode39Writer::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedCode39Writer::EncodeImpl(const ByteString& contents,
int32_t& outlength) {
char checksum = CalcCheckSum(contents);
if (checksum == '*')
@@ -169,7 +169,7 @@ uint8_t* CBC_OnedCode39Writer::EncodeImpl(const CFX_ByteString& contents,
int8_t widths[9] = {0};
int32_t wideStrideNum = 3;
int32_t narrStrideNum = 9 - wideStrideNum;
- CFX_ByteString encodedContents = contents;
+ ByteString encodedContents = contents;
if (m_bCalcChecksum)
encodedContents += checksum;
m_iContentLen = encodedContents.GetLength();
@@ -227,12 +227,12 @@ uint8_t* CBC_OnedCode39Writer::EncodeImpl(const CFX_ByteString& contents,
return result.release();
}
-bool CBC_OnedCode39Writer::encodedContents(const CFX_WideStringC& contents,
- CFX_WideString* result) {
- *result = CFX_WideString(contents);
+bool CBC_OnedCode39Writer::encodedContents(const WideStringView& contents,
+ WideString* result) {
+ *result = WideString(contents);
if (m_bCalcChecksum && m_bPrintChecksum) {
- CFX_WideString checksumContent = FilterContents(contents);
- CFX_ByteString str = checksumContent.UTF8Encode();
+ WideString checksumContent = FilterContents(contents);
+ ByteString str = checksumContent.UTF8Encode();
char checksum;
checksum = CalcCheckSum(str);
if (checksum == '*')
@@ -243,12 +243,12 @@ bool CBC_OnedCode39Writer::encodedContents(const CFX_WideStringC& contents,
return true;
}
-bool CBC_OnedCode39Writer::RenderResult(const CFX_WideStringC& contents,
+bool CBC_OnedCode39Writer::RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) {
- CFX_WideString encodedCon;
+ WideString encodedCon;
if (!encodedContents(contents, &encodedCon))
return false;
- return CBC_OneDimWriter::RenderResult(encodedCon.AsStringC(), code,
+ return CBC_OneDimWriter::RenderResult(encodedCon.AsStringView(), code,
codeLength);
}
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.h b/fxbarcode/oned/BC_OnedCode39Writer.h
index fe57d3ca9a..ffed6d9c07 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.h
+++ b/fxbarcode/oned/BC_OnedCode39Writer.h
@@ -16,28 +16,27 @@ class CBC_OnedCode39Writer : public CBC_OneDimWriter {
~CBC_OnedCode39Writer() override;
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool RenderResult(const CFX_WideStringC& contents,
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool RenderResult(const WideStringView& contents,
uint8_t* code,
int32_t codeLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
- CFX_WideString RenderTextContents(const CFX_WideStringC& contents) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
+ WideString RenderTextContents(const WideStringView& contents) override;
virtual bool SetTextLocation(BC_TEXT_LOC loction);
virtual bool SetWideNarrowRatio(int8_t ratio);
- bool encodedContents(const CFX_WideStringC& contents, CFX_WideString* result);
+ bool encodedContents(const WideStringView& contents, WideString* result);
private:
void ToIntArray(int32_t a, int8_t* toReturn);
- char CalcCheckSum(const CFX_ByteString& contents);
+ char CalcCheckSum(const ByteString& contents);
int8_t m_iWideNarrRatio;
};
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 2d9759b9eb..6de7c2cb20 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -56,14 +56,12 @@ CBC_OnedEAN13Writer::CBC_OnedEAN13Writer() {
}
CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() {}
-bool CBC_OnedEAN13Writer::CheckContentValidity(
- const CFX_WideStringC& contents) {
+bool CBC_OnedEAN13Writer::CheckContentValidity(const WideStringView& contents) {
return std::all_of(contents.begin(), contents.end(), std::iswdigit);
}
-CFX_WideString CBC_OnedEAN13Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedEAN13Writer::FilterContents(const WideStringView& contents) {
+ WideString filtercontents;
wchar_t ch;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
ch = contents[i];
@@ -78,11 +76,11 @@ CFX_WideString CBC_OnedEAN13Writer::FilterContents(
return filtercontents;
}
-int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString& contents) {
+int32_t CBC_OnedEAN13Writer::CalcChecksum(const ByteString& contents) {
return EANCalcChecksum(contents);
}
-uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -93,7 +91,7 @@ uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const CFX_ByteString& contents,
hints);
}
-uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
if (contents.GetLength() != 13)
return nullptr;
@@ -136,7 +134,7 @@ uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const CFX_ByteString& contents,
return result.release();
}
-bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
+bool CBC_OnedEAN13Writer::ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
@@ -146,12 +144,12 @@ bool CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
int32_t leftPadding = 7 * multiple;
int32_t leftPosition = 3 * multiple + leftPadding;
- CFX_ByteString str = FX_UTF8Encode(contents);
+ ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
std::vector<FXTEXT_CHARPOS> charpos(iLen);
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
- CFX_ByteString tempStr = str.Mid(1, 6);
+ ByteString tempStr = str.Mid(1, 6);
int32_t strWidth = multiple * 42;
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.h b/fxbarcode/oned/BC_OnedEAN13Writer.h
index 826d1610a0..c874610a64 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.h
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.h
@@ -20,20 +20,19 @@ class CBC_OnedEAN13Writer : public CBC_OneDimWriter {
~CBC_OnedEAN13Writer() override;
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
- int32_t CalcChecksum(const CFX_ByteString& contents);
+ int32_t CalcChecksum(const ByteString& contents);
protected:
- bool ShowChars(const CFX_WideStringC& contents,
+ bool ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index d4d438fe04..f92a1627b6 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -63,13 +63,12 @@ bool CBC_OnedEAN8Writer::SetTextLocation(BC_TEXT_LOC location) {
return false;
}
-bool CBC_OnedEAN8Writer::CheckContentValidity(const CFX_WideStringC& contents) {
+bool CBC_OnedEAN8Writer::CheckContentValidity(const WideStringView& contents) {
return std::all_of(contents.begin(), contents.end(), std::iswdigit);
}
-CFX_WideString CBC_OnedEAN8Writer::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedEAN8Writer::FilterContents(const WideStringView& contents) {
+ WideString filtercontents;
wchar_t ch;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
ch = contents[i];
@@ -84,11 +83,11 @@ CFX_WideString CBC_OnedEAN8Writer::FilterContents(
return filtercontents;
}
-int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString& contents) {
+int32_t CBC_OnedEAN8Writer::CalcChecksum(const ByteString& contents) {
return EANCalcChecksum(contents);
}
-uint8_t* CBC_OnedEAN8Writer::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedEAN8Writer::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -99,7 +98,7 @@ uint8_t* CBC_OnedEAN8Writer::EncodeWithHint(const CFX_ByteString& contents,
hints);
}
-uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
if (contents.GetLength() != 8)
return nullptr;
@@ -136,7 +135,7 @@ uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const CFX_ByteString& contents,
return result.release();
}
-bool CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
+bool CBC_OnedEAN8Writer::ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
@@ -145,10 +144,10 @@ bool CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
return false;
int32_t leftPosition = 3 * multiple;
- CFX_ByteString str = FX_UTF8Encode(contents);
+ ByteString str = FX_UTF8Encode(contents);
FX_STRSIZE iLength = str.GetLength();
std::vector<FXTEXT_CHARPOS> charpos(iLength);
- CFX_ByteString tempStr = str.Left(4);
+ ByteString tempStr = str.Left(4);
FX_STRSIZE iLen = tempStr.GetLength();
int32_t strWidth = 7 * multiple * 4;
float blank = 0.0;
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.h b/fxbarcode/oned/BC_OnedEAN8Writer.h
index 70c8fd4641..77a3602f67 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.h
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.h
@@ -21,22 +21,21 @@ class CBC_OnedEAN8Writer : public CBC_OneDimWriter {
~CBC_OnedEAN8Writer() override;
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
void SetDataLength(int32_t length) override;
bool SetTextLocation(BC_TEXT_LOC location);
- int32_t CalcChecksum(const CFX_ByteString& contents);
+ int32_t CalcChecksum(const ByteString& contents);
protected:
- bool ShowChars(const CFX_WideStringC& contents,
+ bool ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/fxbarcode/oned/BC_OnedEANChecksum.cpp b/fxbarcode/oned/BC_OnedEANChecksum.cpp
index 744a60827e..64aa1c5f43 100644
--- a/fxbarcode/oned/BC_OnedEANChecksum.cpp
+++ b/fxbarcode/oned/BC_OnedEANChecksum.cpp
@@ -6,7 +6,7 @@
#include "core/fxcrt/fx_extension.h"
-int32_t EANCalcChecksum(const CFX_ByteString& contents) {
+int32_t EANCalcChecksum(const ByteString& contents) {
int32_t odd = 0;
int32_t even = 0;
FX_STRSIZE parity = 1;
diff --git a/fxbarcode/oned/BC_OnedEANChecksum.h b/fxbarcode/oned/BC_OnedEANChecksum.h
index 47d2d6bd91..5dd24bc269 100644
--- a/fxbarcode/oned/BC_OnedEANChecksum.h
+++ b/fxbarcode/oned/BC_OnedEANChecksum.h
@@ -7,6 +7,6 @@
#include "core/fxcrt/fx_string.h"
-int32_t EANCalcChecksum(const CFX_ByteString& contents);
+int32_t EANCalcChecksum(const ByteString& contents);
#endif // FXBARCODE_ONED_BC_ONEDEANCHECKSUM_H_
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index fac4a1b0a3..51858452e9 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -42,7 +42,7 @@ void CBC_OnedUPCAWriter::Init() {
CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {}
-bool CBC_OnedUPCAWriter::CheckContentValidity(const CFX_WideStringC& contents) {
+bool CBC_OnedUPCAWriter::CheckContentValidity(const WideStringView& contents) {
for (FX_STRSIZE i = 0; i < contents.GetLength(); ++i) {
if (contents[i] < '0' || contents[i] > '9')
return false;
@@ -50,9 +50,8 @@ bool CBC_OnedUPCAWriter::CheckContentValidity(const CFX_WideStringC& contents) {
return true;
}
-CFX_WideString CBC_OnedUPCAWriter::FilterContents(
- const CFX_WideStringC& contents) {
- CFX_WideString filtercontents;
+WideString CBC_OnedUPCAWriter::FilterContents(const WideStringView& contents) {
+ WideString filtercontents;
wchar_t ch;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
ch = contents[i];
@@ -67,7 +66,7 @@ CFX_WideString CBC_OnedUPCAWriter::FilterContents(
return filtercontents;
}
-int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) {
+int32_t CBC_OnedUPCAWriter::CalcChecksum(const ByteString& contents) {
int32_t odd = 0;
int32_t even = 0;
FX_STRSIZE j = 1;
@@ -84,7 +83,7 @@ int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) {
return checksum;
}
-uint8_t* CBC_OnedUPCAWriter::EncodeWithHint(const CFX_ByteString& contents,
+uint8_t* CBC_OnedUPCAWriter::EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
@@ -92,18 +91,18 @@ uint8_t* CBC_OnedUPCAWriter::EncodeWithHint(const CFX_ByteString& contents,
if (format != BCFORMAT_UPC_A)
return nullptr;
- CFX_ByteString toEAN13String = '0' + contents;
+ ByteString toEAN13String = '0' + contents;
m_iDataLenth = 13;
return m_subWriter->EncodeWithHint(toEAN13String, BCFORMAT_EAN_13, outWidth,
outHeight, hints);
}
-uint8_t* CBC_OnedUPCAWriter::EncodeImpl(const CFX_ByteString& contents,
+uint8_t* CBC_OnedUPCAWriter::EncodeImpl(const ByteString& contents,
int32_t& outLength) {
return nullptr;
}
-bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
+bool CBC_OnedUPCAWriter::ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
@@ -113,10 +112,10 @@ bool CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
int32_t leftPadding = 7 * multiple;
int32_t leftPosition = 10 * multiple + leftPadding;
- CFX_ByteString str = FX_UTF8Encode(contents);
+ ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
std::vector<FXTEXT_CHARPOS> charpos(iLen);
- CFX_ByteString tempStr = str.Mid(1, 5);
+ ByteString tempStr = str.Mid(1, 5);
float strWidth = (float)35 * multiple;
float blank = 0.0;
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.h b/fxbarcode/oned/BC_OnedUPCAWriter.h
index 80f6196748..a854ef4665 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.h
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.h
@@ -24,21 +24,20 @@ class CBC_OnedUPCAWriter : public CBC_OneDimWriter {
~CBC_OnedUPCAWriter() override;
// CBC_OneDimWriter
- uint8_t* EncodeWithHint(const CFX_ByteString& contents,
+ uint8_t* EncodeWithHint(const ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
int32_t& outHeight,
int32_t hints) override;
- uint8_t* EncodeImpl(const CFX_ByteString& contents,
- int32_t& outLength) override;
- bool CheckContentValidity(const CFX_WideStringC& contents) override;
- CFX_WideString FilterContents(const CFX_WideStringC& contents) override;
+ uint8_t* EncodeImpl(const ByteString& contents, int32_t& outLength) override;
+ bool CheckContentValidity(const WideStringView& contents) override;
+ WideString FilterContents(const WideStringView& contents) override;
void Init();
- int32_t CalcChecksum(const CFX_ByteString& contents);
+ int32_t CalcChecksum(const ByteString& contents);
protected:
- bool ShowChars(const CFX_WideStringC& contents,
+ bool ShowChars(const WideStringView& contents,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
diff --git a/fxbarcode/pdf417/BC_PDF417.cpp b/fxbarcode/pdf417/BC_PDF417.cpp
index 3f492f9c10..9b73b49a26 100644
--- a/fxbarcode/pdf417/BC_PDF417.cpp
+++ b/fxbarcode/pdf417/BC_PDF417.cpp
@@ -399,7 +399,7 @@ CBC_BarcodeMatrix* CBC_PDF417::getBarcodeMatrix() {
return m_barcodeMatrix.get();
}
-bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg,
+bool CBC_PDF417::generateBarcodeLogic(WideString msg,
int32_t errorCorrectionLevel) {
int32_t errorCorrectionCodeWords =
CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(
@@ -408,7 +408,7 @@ bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg,
return false;
int32_t e = BCExceptionNO;
- CFX_WideString highLevel =
+ WideString highLevel =
CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e);
if (e != BCExceptionNO)
return false;
@@ -425,19 +425,19 @@ bool CBC_PDF417::generateBarcodeLogic(CFX_WideString msg,
return false;
int32_t n = sourceCodeWords + pad + 1;
- CFX_WideString sb;
+ WideString sb;
sb += (wchar_t)n;
sb += highLevel;
for (int32_t i = 0; i < pad; i++)
sb += (wchar_t)900;
- CFX_WideString dataCodewords(sb);
- CFX_WideString ec;
+ WideString dataCodewords(sb);
+ WideString ec;
if (!CBC_PDF417ErrorCorrection::generateErrorCorrection(
dataCodewords, errorCorrectionLevel, &ec)) {
return false;
}
- CFX_WideString fullCodewords = dataCodewords + ec;
+ WideString fullCodewords = dataCodewords + ec;
m_barcodeMatrix = pdfium::MakeUnique<CBC_BarcodeMatrix>(rows, cols);
encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel,
m_barcodeMatrix.get());
@@ -498,7 +498,7 @@ void CBC_PDF417::encodeChar(int32_t pattern,
logic->addBar(last, width);
}
-void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords,
+void CBC_PDF417::encodeLowLevel(WideString fullCodewords,
int32_t c,
int32_t r,
int32_t errorCorrectionLevel,
diff --git a/fxbarcode/pdf417/BC_PDF417.h b/fxbarcode/pdf417/BC_PDF417.h
index e6140a8fd7..6014df0e3b 100644
--- a/fxbarcode/pdf417/BC_PDF417.h
+++ b/fxbarcode/pdf417/BC_PDF417.h
@@ -23,7 +23,7 @@ class CBC_PDF417 {
virtual ~CBC_PDF417();
CBC_BarcodeMatrix* getBarcodeMatrix();
- bool generateBarcodeLogic(CFX_WideString msg, int32_t errorCorrectionLevel);
+ bool generateBarcodeLogic(WideString msg, int32_t errorCorrectionLevel);
void setDimensions(int32_t maxCols,
int32_t minCols,
int32_t maxRows,
@@ -45,7 +45,7 @@ class CBC_PDF417 {
int32_t c,
int32_t r);
static void encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic);
- void encodeLowLevel(CFX_WideString fullCodewords,
+ void encodeLowLevel(WideString fullCodewords,
int32_t c,
int32_t r,
int32_t errorCorrectionLevel,
diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
index 1d8258e720..ade3eb584d 100644
--- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
+++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp
@@ -132,9 +132,9 @@ int32_t CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(
}
bool CBC_PDF417ErrorCorrection::generateErrorCorrection(
- const CFX_WideString& dataCodewords,
+ const WideString& dataCodewords,
int32_t errorCorrectionLevel,
- CFX_WideString* result) {
+ WideString* result) {
assert(result);
assert(result->IsEmpty());
diff --git a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
index 3a84ef5845..3e28162653 100644
--- a/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
+++ b/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h
@@ -17,9 +17,9 @@ class CBC_PDF417ErrorCorrection {
virtual ~CBC_PDF417ErrorCorrection();
static int32_t getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel);
- static bool generateErrorCorrection(const CFX_WideString& dataCodewords,
+ static bool generateErrorCorrection(const WideString& dataCodewords,
int32_t errorCorrectionLevel,
- CFX_WideString* result);
+ WideString* result);
};
#endif // FXBARCODE_PDF417_BC_PDF417ERRORCORRECTION_H_
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
index c531716e4f..1450b37ea9 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
@@ -55,24 +55,23 @@ void CBC_PDF417HighLevelEncoder::Initialize() {
void CBC_PDF417HighLevelEncoder::Finalize() {}
-CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(
- CFX_WideString wideMsg,
- Compaction compaction,
- int32_t& e) {
- CFX_ByteString bytes;
+WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(WideString wideMsg,
+ Compaction compaction,
+ int32_t& e) {
+ ByteString bytes;
CBC_UtilCodingConvert::UnicodeToUTF8(wideMsg, bytes);
- CFX_WideString msg;
+ WideString msg;
int32_t len = bytes.GetLength();
for (int32_t i = 0; i < len; i++) {
wchar_t ch = (wchar_t)(bytes[i] & 0xff);
if (ch == '?' && bytes[i] != '?') {
e = BCExceptionCharactersOutsideISO88591Encoding;
- return CFX_WideString();
+ return WideString();
}
msg += ch;
}
std::vector<uint8_t> byteArr(bytes.begin(), bytes.end());
- CFX_WideString sb;
+ WideString sb;
len = msg.GetLength();
int32_t p = 0;
int32_t textSubMode = SUBMODE_ALPHA;
@@ -145,12 +144,12 @@ void CBC_PDF417HighLevelEncoder::Inverse() {
}
}
-int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg,
+int32_t CBC_PDF417HighLevelEncoder::encodeText(WideString msg,
int32_t startpos,
int32_t count,
- CFX_WideString& sb,
+ WideString& sb,
int32_t initialSubmode) {
- CFX_WideString tmp;
+ WideString tmp;
int32_t submode = initialSubmode;
int32_t idx = 0;
while (true) {
@@ -262,7 +261,7 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t count,
int32_t startmode,
- CFX_WideString& sb) {
+ WideString& sb) {
if (count == 1 && startmode == TEXT_COMPACTION) {
sb += (wchar_t)SHIFT_TO_BYTE;
}
@@ -295,16 +294,16 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(std::vector<uint8_t>* bytes,
sb += (wchar_t)ch;
}
}
-void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg,
+void CBC_PDF417HighLevelEncoder::encodeNumeric(WideString msg,
int32_t startpos,
int32_t count,
- CFX_WideString& sb) {
+ WideString& sb) {
int32_t idx = 0;
BigInteger num900 = 900;
while (idx < count) {
- CFX_WideString tmp;
+ WideString tmp;
int32_t len = 44 < count - idx ? 44 : count - idx;
- CFX_ByteString part =
+ ByteString part =
((wchar_t)'1' + msg.Mid(startpos + idx, len)).UTF8Encode();
BigInteger bigint = stringToBigInteger(part.c_str());
do {
@@ -337,7 +336,7 @@ bool CBC_PDF417HighLevelEncoder::isText(wchar_t ch) {
return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126);
}
int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(
- CFX_WideString msg,
+ WideString msg,
int32_t startpos) {
int32_t count = 0;
int32_t len = msg.GetLength();
@@ -355,7 +354,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(
return count;
}
int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(
- CFX_WideString msg,
+ WideString msg,
int32_t startpos) {
int32_t len = msg.GetLength();
int32_t idx = startpos;
@@ -384,7 +383,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(
return idx - startpos;
}
int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(
- CFX_WideString msg,
+ WideString msg,
std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t& e) {
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
index 32482dc22b..2701c810fb 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
@@ -14,9 +14,9 @@
class CBC_PDF417HighLevelEncoder {
public:
- static CFX_WideString encodeHighLevel(CFX_WideString msg,
- Compaction compaction,
- int32_t& e);
+ static WideString encodeHighLevel(WideString msg,
+ Compaction compaction,
+ int32_t& e);
static void Inverse();
static void Initialize();
static void Finalize();
@@ -35,31 +35,31 @@ class CBC_PDF417HighLevelEncoder {
static uint8_t TEXT_PUNCTUATION_RAW[];
static int32_t MIXED[128];
static int32_t PUNCTUATION[128];
- static int32_t encodeText(CFX_WideString msg,
+ static int32_t encodeText(WideString msg,
int32_t startpos,
int32_t count,
- CFX_WideString& sb,
+ WideString& sb,
int32_t initialSubmode);
static void encodeBinary(std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t count,
int32_t startmode,
- CFX_WideString& sb);
- static void encodeNumeric(CFX_WideString msg,
+ WideString& sb);
+ static void encodeNumeric(WideString msg,
int32_t startpos,
int32_t count,
- CFX_WideString& sb);
+ WideString& sb);
static bool isDigit(wchar_t ch);
static bool isAlphaUpper(wchar_t ch);
static bool isAlphaLower(wchar_t ch);
static bool isMixed(wchar_t ch);
static bool isPunctuation(wchar_t ch);
static bool isText(wchar_t ch);
- static int32_t determineConsecutiveDigitCount(CFX_WideString msg,
+ static int32_t determineConsecutiveDigitCount(WideString msg,
int32_t startpos);
- static int32_t determineConsecutiveTextCount(CFX_WideString msg,
+ static int32_t determineConsecutiveTextCount(WideString msg,
int32_t startpos);
- static int32_t determineConsecutiveBinaryCount(CFX_WideString msg,
+ static int32_t determineConsecutiveBinaryCount(WideString msg,
std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t& e);
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
index 14311742f1..ad4a59af40 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
@@ -47,8 +47,8 @@ TEST(PDF417HighLevelEncoder, EncodeBinary) {
for (size_t j = 0; j < input_length; ++j) {
input_array[j] = ptr->input[j];
}
- CFX_WideString expected(ptr->expected, ptr->expected_length);
- CFX_WideString result;
+ WideString expected(ptr->expected, ptr->expected_length);
+ WideString result;
CBC_PDF417HighLevelEncoder::encodeBinary(
&input_array, ptr->offset, ptr->count, ptr->startmode, result);
EXPECT_EQ(expected, result) << " for case number " << i;
@@ -109,9 +109,9 @@ TEST(PDF417HighLevelEncoder, EncodeNumeric) {
CBC_PDF417HighLevelEncoder::Initialize();
for (size_t i = 0; i < FX_ArraySize(encode_numeric_cases); ++i) {
EncodeNumericCase* ptr = &encode_numeric_cases[i];
- CFX_WideString input(ptr->input);
- CFX_WideString expected(ptr->expected, ptr->expected_length);
- CFX_WideString result;
+ WideString input(ptr->input);
+ WideString expected(ptr->expected, ptr->expected_length);
+ WideString result;
CBC_PDF417HighLevelEncoder::encodeNumeric(input, ptr->offset, ptr->count,
result);
EXPECT_EQ(expected, result) << " for case number " << i;
@@ -156,7 +156,7 @@ TEST(PDF417HighLevelEncoder, ConsecutiveDigitCount) {
CBC_PDF417HighLevelEncoder::Initialize();
for (size_t i = 0; i < FX_ArraySize(consecutive_digit_cases); ++i) {
ConsecutiveDigitCase* ptr = &consecutive_digit_cases[i];
- CFX_WideString input(ptr->input);
+ WideString input(ptr->input);
int actual_count =
CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(input,
ptr->offset);
@@ -217,7 +217,7 @@ TEST(PDF417HighLevelEncoder, ConsecutiveTextCount) {
CBC_PDF417HighLevelEncoder::Initialize();
for (size_t i = 0; i < FX_ArraySize(consecutive_text_cases); ++i) {
ConsecutiveTextCase* ptr = &consecutive_text_cases[i];
- CFX_WideString input(ptr->input);
+ WideString input(ptr->input);
int actual_count =
CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(input,
ptr->offset);
diff --git a/fxbarcode/pdf417/BC_PDF417Writer.cpp b/fxbarcode/pdf417/BC_PDF417Writer.cpp
index 2f6fc9e1b0..4fec974737 100644
--- a/fxbarcode/pdf417/BC_PDF417Writer.cpp
+++ b/fxbarcode/pdf417/BC_PDF417Writer.cpp
@@ -48,7 +48,7 @@ void CBC_PDF417Writer::SetTruncated(bool truncated) {
m_bTruncated = truncated;
}
-uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
+uint8_t* CBC_PDF417Writer::Encode(const WideString& contents,
int32_t& outWidth,
int32_t& outHeight) {
CBC_PDF417 encoder;
diff --git a/fxbarcode/pdf417/BC_PDF417Writer.h b/fxbarcode/pdf417/BC_PDF417Writer.h
index 39418715ce..ef5961653e 100644
--- a/fxbarcode/pdf417/BC_PDF417Writer.h
+++ b/fxbarcode/pdf417/BC_PDF417Writer.h
@@ -18,7 +18,7 @@ class CBC_PDF417Writer : public CBC_TwoDimWriter {
CBC_PDF417Writer();
~CBC_PDF417Writer() override;
- uint8_t* Encode(const CFX_WideString& contents,
+ uint8_t* Encode(const WideString& contents,
int32_t& outWidth,
int32_t& outHeight);
diff --git a/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/fxbarcode/qrcode/BC_QRCodeWriter.cpp
index c679e9fca6..eb35af3867 100644
--- a/fxbarcode/qrcode/BC_QRCodeWriter.cpp
+++ b/fxbarcode/qrcode/BC_QRCodeWriter.cpp
@@ -55,7 +55,7 @@ bool CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) {
return true;
}
-uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents,
+uint8_t* CBC_QRCodeWriter::Encode(const WideString& contents,
int32_t ecLevel,
int32_t& outWidth,
int32_t& outHeight) {
diff --git a/fxbarcode/qrcode/BC_QRCodeWriter.h b/fxbarcode/qrcode/BC_QRCodeWriter.h
index 1a0502d72e..3b3efc90ca 100644
--- a/fxbarcode/qrcode/BC_QRCodeWriter.h
+++ b/fxbarcode/qrcode/BC_QRCodeWriter.h
@@ -17,7 +17,7 @@ class CBC_QRCodeWriter : public CBC_TwoDimWriter {
static void ReleaseAll();
- uint8_t* Encode(const CFX_WideString& contents,
+ uint8_t* Encode(const WideString& contents,
int32_t ecLevel,
int32_t& outWidth,
int32_t& outHeight);
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 4c488418d9..e1a4917792 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -41,7 +41,7 @@
#include "fxbarcode/qrcode/BC_QRCoderVersion.h"
#include "third_party/base/ptr_util.h"
-using ModeStringPair = std::pair<CBC_QRCoderMode*, CFX_ByteString>;
+using ModeStringPair = std::pair<CBC_QRCoderMode*, ByteString>;
namespace {
@@ -61,7 +61,7 @@ int32_t GetAlphaNumericCode(int32_t code) {
return g_alphaNumericTable[code_index];
}
-void AppendNumericBytes(const CFX_ByteString& content,
+void AppendNumericBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
int32_t& e) {
int32_t length = content.GetLength();
@@ -84,7 +84,7 @@ void AppendNumericBytes(const CFX_ByteString& content,
}
}
-void AppendAlphaNumericBytes(const CFX_ByteString& content,
+void AppendAlphaNumericBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
int32_t& e) {
int32_t length = content.GetLength();
@@ -110,7 +110,7 @@ void AppendAlphaNumericBytes(const CFX_ByteString& content,
}
}
-void AppendGBKBytes(const CFX_ByteString& content,
+void AppendGBKBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
int32_t& e) {
int32_t length = content.GetLength();
@@ -130,15 +130,15 @@ void AppendGBKBytes(const CFX_ByteString& content,
}
}
-void Append8BitBytes(const CFX_ByteString& content,
+void Append8BitBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
- CFX_ByteString encoding,
+ ByteString encoding,
int32_t& e) {
for (FX_STRSIZE i = 0; i < content.GetLength(); i++)
bits->AppendBits(content[i], 8);
}
-void AppendKanjiBytes(const CFX_ByteString& content,
+void AppendKanjiBytes(const ByteString& content,
CBC_QRCoderBitVector* bits,
int32_t& e) {
std::vector<uint8_t> bytes;
@@ -184,10 +184,10 @@ bool AppendLengthInfo(int32_t numLetters,
return true;
}
-void AppendBytes(const CFX_ByteString& content,
+void AppendBytes(const ByteString& content,
CBC_QRCoderMode* mode,
CBC_QRCoderBitVector* bits,
- CFX_ByteString encoding,
+ ByteString encoding,
int32_t& e) {
if (mode == CBC_QRCoderMode::sNUMERIC)
AppendNumericBytes(content, bits, e);
@@ -423,7 +423,7 @@ void MergeString(std::vector<ModeStringPair>* result,
MergeString(result, versionNum, e);
}
-void SplitString(const CFX_ByteString& content,
+void SplitString(const ByteString& content,
std::vector<ModeStringPair>* result) {
FX_STRSIZE index = 0;
while (index < content.GetLength()) {
@@ -484,8 +484,7 @@ void SplitString(const CFX_ByteString& content,
SplitString(content.Right(content.GetLength() - index), result);
}
-CBC_QRCoderMode* ChooseMode(const CFX_ByteString& content,
- CFX_ByteString encoding) {
+CBC_QRCoderMode* ChooseMode(const ByteString& content, ByteString encoding) {
if (encoding.Compare("SHIFT_JIS") == 0)
return CBC_QRCoderMode::sKANJI;
@@ -566,11 +565,11 @@ CBC_QRCoderEncoder::CBC_QRCoderEncoder() {}
CBC_QRCoderEncoder::~CBC_QRCoderEncoder() {}
// static
-bool CBC_QRCoderEncoder::Encode(const CFX_WideString& content,
+bool CBC_QRCoderEncoder::Encode(const WideString& content,
const CBC_QRCoderErrorCorrectionLevel* ecLevel,
CBC_QRCoder* qrCode) {
- CFX_ByteString encoding = "utf8";
- CFX_ByteString utf8Data;
+ ByteString encoding = "utf8";
+ ByteString utf8Data;
CBC_UtilCodingConvert::UnicodeToUTF8(content, utf8Data);
CBC_QRCoderMode* mode = ChooseMode(utf8Data, encoding);
CBC_QRCoderBitVector dataBits;
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.h b/fxbarcode/qrcode/BC_QRCoderEncoder.h
index 6bba889bd4..3acbd1bde8 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.h
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.h
@@ -20,7 +20,7 @@ class CBC_QRCoderEncoder {
CBC_QRCoderEncoder();
~CBC_QRCoderEncoder();
- static bool Encode(const CFX_WideString& content,
+ static bool Encode(const WideString& content,
const CBC_QRCoderErrorCorrectionLevel* ecLevel,
CBC_QRCoder* qrCode);
};
diff --git a/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h b/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
index e153c64395..ff7563ccfe 100644
--- a/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
+++ b/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h
@@ -25,7 +25,7 @@ class CBC_QRCoderErrorCorrectionLevel {
int32_t Ordinal() const { return m_ordinal; }
int32_t GetBits() const { return m_bits; }
- CFX_ByteString GetName() const { return m_name; }
+ ByteString GetName() const { return m_name; }
private:
CBC_QRCoderErrorCorrectionLevel(int32_t ordinal,
@@ -35,7 +35,7 @@ class CBC_QRCoderErrorCorrectionLevel {
int32_t m_ordinal;
int32_t m_bits;
- CFX_ByteString m_name;
+ ByteString m_name;
};
#endif // FXBARCODE_QRCODE_BC_QRCODERERRORCORRECTIONLEVEL_H_
diff --git a/fxbarcode/qrcode/BC_QRCoderMode.cpp b/fxbarcode/qrcode/BC_QRCoderMode.cpp
index 5f9ce5bf25..0f8c227843 100644
--- a/fxbarcode/qrcode/BC_QRCoderMode.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderMode.cpp
@@ -39,7 +39,7 @@ CBC_QRCoderMode* CBC_QRCoderMode::sSTRUCTURED_APPEND = nullptr;
CBC_QRCoderMode::CBC_QRCoderMode(std::vector<int32_t> charCountBits,
int32_t bits,
- CFX_ByteString name)
+ ByteString name)
: m_characterCountBitsForVersions(std::move(charCountBits)),
m_bits(bits),
m_name(name) {}
@@ -107,7 +107,7 @@ int32_t CBC_QRCoderMode::GetBits() const {
return m_bits;
}
-CFX_ByteString CBC_QRCoderMode::GetName() const {
+ByteString CBC_QRCoderMode::GetName() const {
return m_name;
}
diff --git a/fxbarcode/qrcode/BC_QRCoderMode.h b/fxbarcode/qrcode/BC_QRCoderMode.h
index 6669cbfbc9..9f2844da97 100644
--- a/fxbarcode/qrcode/BC_QRCoderMode.h
+++ b/fxbarcode/qrcode/BC_QRCoderMode.h
@@ -24,7 +24,7 @@ class CBC_QRCoderMode {
int32_t GetCharacterCountBits(int32_t number, int32_t& e) const;
int32_t GetBits() const;
- CFX_ByteString GetName() const;
+ ByteString GetName() const;
static CBC_QRCoderMode* sBYTE;
static CBC_QRCoderMode* sNUMERIC;
@@ -41,11 +41,11 @@ class CBC_QRCoderMode {
CBC_QRCoderMode();
CBC_QRCoderMode(std::vector<int32_t> charCountBits,
int32_t bits,
- CFX_ByteString name);
+ ByteString name);
std::vector<int32_t> m_characterCountBitsForVersions;
const int32_t m_bits;
- const CFX_ByteString m_name;
+ const ByteString m_name;
};
#endif // FXBARCODE_QRCODE_BC_QRCODERMODE_H_
diff --git a/fxbarcode/utils.h b/fxbarcode/utils.h
index df7d1f08d1..7d5bc0a6d8 100644
--- a/fxbarcode/utils.h
+++ b/fxbarcode/utils.h
@@ -11,14 +11,13 @@
#include "core/fxcrt/fx_string.h"
-bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
+bool BC_FX_ByteString_Replace(ByteString& dst,
uint32_t first,
uint32_t last,
int32_t count,
char c);
-void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c);
-void BC_FX_ByteString_Append(CFX_ByteString& dst,
- const std::vector<uint8_t>& ba);
+void BC_FX_ByteString_Append(ByteString& dst, int32_t count, char c);
+void BC_FX_ByteString_Append(ByteString& dst, const std::vector<uint8_t>& ba);
#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
#include <limits>
diff --git a/fxjs/cfxjse_arguments.cpp b/fxjs/cfxjse_arguments.cpp
index 363f39ce11..f390cefdf8 100644
--- a/fxjs/cfxjse_arguments.cpp
+++ b/fxjs/cfxjse_arguments.cpp
@@ -39,10 +39,10 @@ float CFXJSE_Arguments::GetFloat(int32_t index) const {
return static_cast<float>((*m_pInfo)[index]->NumberValue());
}
-CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
+ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const {
v8::Local<v8::String> hString = (*m_pInfo)[index]->ToString();
v8::String::Utf8Value szStringVal(hString);
- return CFX_ByteString(*szStringVal);
+ return ByteString(*szStringVal);
}
CFXJSE_HostObject* CFXJSE_Arguments::GetObject(int32_t index,
diff --git a/fxjs/cfxjse_arguments.h b/fxjs/cfxjse_arguments.h
index 9317d70898..0553335535 100644
--- a/fxjs/cfxjse_arguments.h
+++ b/fxjs/cfxjse_arguments.h
@@ -24,7 +24,7 @@ class CFXJSE_Arguments {
bool GetBoolean(int32_t index) const;
int32_t GetInt32(int32_t index) const;
float GetFloat(int32_t index) const;
- CFX_ByteString GetUTF8String(int32_t index) const;
+ ByteString GetUTF8String(int32_t index) const;
CFXJSE_HostObject* GetObject(int32_t index,
CFXJSE_Class* pClass = nullptr) const;
CFXJSE_Value* GetReturnValue() const;
diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp
index 3dba0abbd6..8f4334f89e 100644
--- a/fxjs/cfxjse_class.cpp
+++ b/fxjs/cfxjse_class.cpp
@@ -24,7 +24,7 @@ void V8FunctionCallback_Wrapper(
if (!lpFunctionInfo)
return;
- CFX_ByteStringC szFunctionName(lpFunctionInfo->name);
+ ByteStringView szFunctionName(lpFunctionInfo->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -42,7 +42,7 @@ void V8ClassGlobalConstructorCallback_Wrapper(
if (!lpClassDefinition)
return;
- CFX_ByteStringC szFunctionName(lpClassDefinition->name);
+ ByteStringView szFunctionName(lpClassDefinition->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -60,7 +60,7 @@ void V8GetterCallback_Wrapper(v8::Local<v8::String> property,
if (!lpPropertyInfo)
return;
- CFX_ByteStringC szPropertyName(lpPropertyInfo->name);
+ ByteStringView szPropertyName(lpPropertyInfo->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
@@ -77,7 +77,7 @@ void V8SetterCallback_Wrapper(v8::Local<v8::String> property,
if (!lpPropertyInfo)
return;
- CFX_ByteStringC szPropertyName(lpPropertyInfo->name);
+ ByteStringView szPropertyName(lpPropertyInfo->name);
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
auto lpPropValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
@@ -108,7 +108,7 @@ void Context_GlobalObjToString(
return;
if (info.This() == info.Holder() && lpClass->name) {
- CFX_ByteString szStringVal;
+ ByteString szStringVal;
szStringVal.Format("[object %s]", lpClass->name);
info.GetReturnValue().Set(v8::String::NewFromUtf8(
info.GetIsolate(), szStringVal.c_str(), v8::String::kNormalString,
@@ -131,7 +131,7 @@ void DynPropGetterAdapter_MethodCallback(
hCallBackInfo->GetInternalField(1).As<v8::String>();
ASSERT(lpClass && !hPropName.IsEmpty());
v8::String::Utf8Value szPropName(hPropName);
- CFX_ByteStringC szFxPropName = *szPropName;
+ ByteStringView szFxPropName = *szPropName;
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(info.Holder());
auto lpRetValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -143,7 +143,7 @@ void DynPropGetterAdapter_MethodCallback(
void DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) {
ASSERT(lpClass);
int32_t nPropType =
@@ -179,7 +179,7 @@ void DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
void DynPropSetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue) {
ASSERT(lpClass);
int32_t nPropType =
@@ -194,7 +194,7 @@ void DynPropSetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
bool DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName) {
+ const ByteStringView& szPropName) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
@@ -205,7 +205,7 @@ bool DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
bool DynPropDeleterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName) {
+ const ByteStringView& szPropName) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
@@ -228,7 +228,7 @@ void NamedPropertyQueryCallback(
v8::Isolate* pIsolate = info.GetIsolate();
v8::HandleScope scope(pIsolate);
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
if (DynPropQueryAdapter(lpClass, lpThisValue.get(), szFxPropName)) {
@@ -248,7 +248,7 @@ void NamedPropertyDeleterCallback(
v8::Isolate* pIsolate = info.GetIsolate();
v8::HandleScope scope(pIsolate);
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
info.GetReturnValue().Set(
@@ -262,7 +262,7 @@ void NamedPropertyGetterCallback(
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
auto lpNewValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
@@ -279,7 +279,7 @@ void NamedPropertySetterCallback(
const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
info.Data().As<v8::External>()->Value());
v8::String::Utf8Value szPropName(property);
- CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
+ ByteStringView szFxPropName(*szPropName, szPropName.length());
auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
diff --git a/fxjs/cfxjse_class.h b/fxjs/cfxjse_class.h
index c3a5c84777..01becfcf60 100644
--- a/fxjs/cfxjse_class.h
+++ b/fxjs/cfxjse_class.h
@@ -32,7 +32,7 @@ class CFXJSE_Class {
v8::Global<v8::FunctionTemplate>& GetTemplate() { return m_hTemplate; }
protected:
- CFX_ByteString m_szClassName;
+ ByteString m_szClassName;
CFX_UnownedPtr<const FXJSE_CLASS_DESCRIPTOR> m_lpClassDefinition;
CFX_UnownedPtr<CFXJSE_Context> m_pContext;
v8::Global<v8::FunctionTemplate> m_hTemplate;
diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp
index 87ec30f9c3..bef7597b52 100644
--- a/fxjs/cfxjse_context.cpp
+++ b/fxjs/cfxjse_context.cpp
@@ -213,7 +213,7 @@ void CFXJSE_Context::AddClass(std::unique_ptr<CFXJSE_Class> pClass) {
}
CFXJSE_Class* CFXJSE_Context::GetClassByName(
- const CFX_ByteStringC& szName) const {
+ const ByteStringView& szName) const {
auto pClass =
std::find_if(m_rgClasses.begin(), m_rgClasses.end(),
[szName](const std::unique_ptr<CFXJSE_Class>& item) {
diff --git a/fxjs/cfxjse_context.h b/fxjs/cfxjse_context.h
index c00b76b02b..8ed876097e 100644
--- a/fxjs/cfxjse_context.h
+++ b/fxjs/cfxjse_context.h
@@ -31,7 +31,7 @@ class CFXJSE_Context {
v8::Local<v8::Context> GetContext();
std::unique_ptr<CFXJSE_Value> GetGlobalObject();
void AddClass(std::unique_ptr<CFXJSE_Class> pClass);
- CFXJSE_Class* GetClassByName(const CFX_ByteStringC& szName) const;
+ CFXJSE_Class* GetClassByName(const ByteStringView& szName) const;
void EnableCompatibleMode();
bool ExecuteScript(const char* szScript,
CFXJSE_Value* lpRetValue,
diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp
index c2eaa408a4..93e568c0ba 100644
--- a/fxjs/cfxjse_value.cpp
+++ b/fxjs/cfxjse_value.cpp
@@ -52,7 +52,7 @@ double ftod(float fNumber) {
} // namespace
-void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message) {
+void FXJSE_ThrowMessage(const ByteStringView& utf8Message) {
v8::Isolate* pIsolate = v8::Isolate::GetCurrent();
ASSERT(pIsolate);
@@ -126,7 +126,7 @@ void CFXJSE_Value::SetFloat(float fFloat) {
m_hValue.Reset(m_pIsolate, pValue);
}
-bool CFXJSE_Value::SetObjectProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::SetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
@@ -144,7 +144,7 @@ bool CFXJSE_Value::SetObjectProperty(const CFX_ByteStringC& szPropName,
hPropValue);
}
-bool CFXJSE_Value::GetObjectProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::GetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
@@ -187,7 +187,7 @@ bool CFXJSE_Value::GetObjectPropertyByIdx(uint32_t uPropIdx,
return true;
}
-bool CFXJSE_Value::DeleteObjectProperty(const CFX_ByteStringC& szPropName) {
+bool CFXJSE_Value::DeleteObjectProperty(const ByteStringView& szPropName) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
@@ -200,7 +200,7 @@ bool CFXJSE_Value::DeleteObjectProperty(const CFX_ByteStringC& szPropName) {
return true;
}
-bool CFXJSE_Value::HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::HasObjectOwnProperty(const ByteStringView& szPropName,
bool bUseTypeGetter) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hObject =
@@ -218,7 +218,7 @@ bool CFXJSE_Value::HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
.FromMaybe(false));
}
-bool CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
+bool CFXJSE_Value::SetObjectOwnProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue) {
ASSERT(lpPropValue);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
@@ -463,13 +463,13 @@ int32_t CFXJSE_Value::ToInteger() const {
return static_cast<int32_t>(hValue->NumberValue());
}
-CFX_ByteString CFXJSE_Value::ToString() const {
+ByteString CFXJSE_Value::ToString() const {
ASSERT(!m_hValue.IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue);
v8::Local<v8::String> hString = hValue->ToString();
v8::String::Utf8Value hStringVal(hString);
- return CFX_ByteString(*hStringVal);
+ return ByteString(*hStringVal);
}
void CFXJSE_Value::SetUndefined() {
@@ -502,7 +502,7 @@ void CFXJSE_Value::SetDouble(double dDouble) {
m_hValue.Reset(m_pIsolate, hValue);
}
-void CFXJSE_Value::SetString(const CFX_ByteStringC& szString) {
+void CFXJSE_Value::SetString(const ByteStringView& szString) {
CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate);
v8::Local<v8::Value> hValue = v8::String::NewFromUtf8(
m_pIsolate, reinterpret_cast<const char*>(szString.raw_str()),
diff --git a/fxjs/cfxjse_value.h b/fxjs/cfxjse_value.h
index 31b751da1e..f506857965 100644
--- a/fxjs/cfxjse_value.h
+++ b/fxjs/cfxjse_value.h
@@ -38,9 +38,9 @@ class CFXJSE_Value {
float ToFloat() const;
double ToDouble() const;
int32_t ToInteger() const;
- CFX_ByteString ToString() const;
- CFX_WideString ToWideString() const {
- return CFX_WideString::FromUTF8(ToString().AsStringC());
+ ByteString ToString() const;
+ WideString ToWideString() const {
+ return WideString::FromUTF8(ToString().AsStringView());
}
CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const;
@@ -49,7 +49,7 @@ class CFXJSE_Value {
void SetBoolean(bool bBoolean);
void SetInteger(int32_t nInteger);
void SetDouble(double dDouble);
- void SetString(const CFX_ByteStringC& szString);
+ void SetString(const ByteStringView& szString);
void SetFloat(float fFloat);
void SetJSObject();
@@ -58,16 +58,16 @@ class CFXJSE_Value {
void SetArray(const std::vector<std::unique_ptr<CFXJSE_Value>>& values);
void SetDate(double dDouble);
- bool GetObjectProperty(const CFX_ByteStringC& szPropName,
+ bool GetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue);
- bool SetObjectProperty(const CFX_ByteStringC& szPropName,
+ bool SetObjectProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue);
bool GetObjectPropertyByIdx(uint32_t uPropIdx, CFXJSE_Value* lpPropValue);
bool SetObjectProperty(uint32_t uPropIdx, CFXJSE_Value* lpPropValue);
- bool DeleteObjectProperty(const CFX_ByteStringC& szPropName);
- bool HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
+ bool DeleteObjectProperty(const ByteStringView& szPropName);
+ bool HasObjectOwnProperty(const ByteStringView& szPropName,
bool bUseTypeGetter);
- bool SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
+ bool SetObjectOwnProperty(const ByteStringView& szPropName,
CFXJSE_Value* lpPropValue);
bool SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis);
bool Call(CFXJSE_Value* lpReceiver,
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index 219ad51d39..4c6398870d 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -460,12 +460,12 @@ void CFXJS_Engine::ReleaseEngine() {
m_isolate->SetData(g_embedderDataSlot, nullptr);
}
-int CFXJS_Engine::Execute(const CFX_WideString& script, FXJSErr* pError) {
+int CFXJS_Engine::Execute(const WideString& script, FXJSErr* pError) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::TryCatch try_catch(m_isolate);
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
v8::Local<v8::Script> compiled_script;
- if (!v8::Script::Compile(context, NewString(script.AsStringC()))
+ if (!v8::Script::Compile(context, NewString(script.AsStringView()))
.ToLocal(&compiled_script)) {
v8::String::Utf8Value error(try_catch.Exception());
// TODO(tsepez): return error via pError->message.
@@ -527,8 +527,8 @@ v8::Local<v8::Object> CFXJS_Engine::GetThisObj() {
return context->Global()->GetPrototype()->ToObject(context).ToLocalChecked();
}
-void CFXJS_Engine::Error(const CFX_WideString& message) {
- m_isolate->ThrowException(NewString(message.AsStringC()));
+void CFXJS_Engine::Error(const WideString& message) {
+ m_isolate->ThrowException(NewString(message.AsStringView()));
}
void CFXJS_Engine::SetObjectPrivate(v8::Local<v8::Object> pObj, void* p) {
@@ -555,28 +555,28 @@ void* CFXJS_Engine::GetObjectPrivate(v8::Local<v8::Object> pObj) {
v8::Local<v8::Value> CFXJS_Engine::GetObjectProperty(
v8::Local<v8::Object> pObj,
- const CFX_WideString& wsPropertyName) {
+ const WideString& wsPropertyName) {
if (pObj.IsEmpty())
return v8::Local<v8::Value>();
v8::Local<v8::Value> val;
if (!pObj->Get(m_isolate->GetCurrentContext(),
- NewString(wsPropertyName.AsStringC()))
+ NewString(wsPropertyName.AsStringView()))
.ToLocal(&val))
return v8::Local<v8::Value>();
return val;
}
-std::vector<CFX_WideString> CFXJS_Engine::GetObjectPropertyNames(
+std::vector<WideString> CFXJS_Engine::GetObjectPropertyNames(
v8::Local<v8::Object> pObj) {
if (pObj.IsEmpty())
- return std::vector<CFX_WideString>();
+ return std::vector<WideString>();
v8::Local<v8::Array> val;
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
if (!pObj->GetPropertyNames(context).ToLocal(&val))
- return std::vector<CFX_WideString>();
+ return std::vector<WideString>();
- std::vector<CFX_WideString> result;
+ std::vector<WideString> result;
for (uint32_t i = 0; i < val->Length(); ++i) {
result.push_back(ToWideString(val->Get(context, i).ToLocalChecked()));
}
@@ -585,12 +585,12 @@ std::vector<CFX_WideString> CFXJS_Engine::GetObjectPropertyNames(
}
void CFXJS_Engine::PutObjectProperty(v8::Local<v8::Object> pObj,
- const CFX_WideString& wsPropertyName,
+ const WideString& wsPropertyName,
v8::Local<v8::Value> pPut) {
if (pObj.IsEmpty())
return;
pObj->Set(m_isolate->GetCurrentContext(),
- NewString(wsPropertyName.AsStringC()), pPut)
+ NewString(wsPropertyName.AsStringView()), pPut)
.FromJust();
}
@@ -649,18 +649,18 @@ v8::Local<v8::Boolean> CFXJS_Engine::NewBoolean(bool b) {
return v8::Boolean::New(m_isolate, b);
}
-v8::Local<v8::String> CFXJS_Engine::NewString(const CFX_ByteStringC& str) {
+v8::Local<v8::String> CFXJS_Engine::NewString(const ByteStringView& str) {
v8::Isolate* pIsolate = m_isolate ? m_isolate : v8::Isolate::GetCurrent();
return v8::String::NewFromUtf8(pIsolate, str.unterminated_c_str(),
v8::NewStringType::kNormal, str.GetLength())
.ToLocalChecked();
}
-v8::Local<v8::String> CFXJS_Engine::NewString(const CFX_WideStringC& str) {
+v8::Local<v8::String> CFXJS_Engine::NewString(const WideStringView& str) {
// Conversion from pdfium's wchar_t wide-strings to v8's uint16_t
// wide-strings isn't handled by v8, so use UTF8 as a common
// intermediate format.
- return NewString(FX_UTF8Encode(str).AsStringC());
+ return NewString(FX_UTF8Encode(str).AsStringView());
}
v8::Local<v8::Value> CFXJS_Engine::NewNull() {
@@ -703,15 +703,15 @@ double CFXJS_Engine::ToDouble(v8::Local<v8::Value> pValue) {
return maybe_number.ToLocalChecked()->Value();
}
-CFX_WideString CFXJS_Engine::ToWideString(v8::Local<v8::Value> pValue) {
+WideString CFXJS_Engine::ToWideString(v8::Local<v8::Value> pValue) {
if (pValue.IsEmpty())
- return CFX_WideString();
+ return WideString();
v8::Local<v8::Context> context = m_isolate->GetCurrentContext();
v8::MaybeLocal<v8::String> maybe_string = pValue->ToString(context);
if (maybe_string.IsEmpty())
- return CFX_WideString();
+ return WideString();
v8::String::Utf8Value s(maybe_string.ToLocalChecked());
- return CFX_WideString::FromUTF8(CFX_ByteStringC(*s, s.length()));
+ return WideString::FromUTF8(ByteStringView(*s, s.length()));
}
v8::Local<v8::Object> CFXJS_Engine::ToObject(v8::Local<v8::Value> pValue) {
@@ -728,11 +728,11 @@ v8::Local<v8::Array> CFXJS_Engine::ToArray(v8::Local<v8::Value> pValue) {
return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
}
-void CFXJS_Engine::SetConstArray(const CFX_WideString& name,
+void CFXJS_Engine::SetConstArray(const WideString& name,
v8::Local<v8::Array> array) {
m_ConstArrays[name] = v8::Global<v8::Array>(GetIsolate(), array);
}
-v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const CFX_WideString& name) {
+v8::Local<v8::Array> CFXJS_Engine::GetConstArray(const WideString& name) {
return v8::Local<v8::Array>::New(GetIsolate(), m_ConstArrays[name]);
}
diff --git a/fxjs/fxjs_v8.h b/fxjs/fxjs_v8.h
index cdec942d4b..457843f387 100644
--- a/fxjs/fxjs_v8.h
+++ b/fxjs/fxjs_v8.h
@@ -174,7 +174,7 @@ class CFXJS_Engine {
void ReleaseEngine();
// Called after FXJS_InitializeEngine call made.
- int Execute(const CFX_WideString& script, FXJSErr* perror);
+ int Execute(const WideString& script, FXJSErr* perror);
v8::Local<v8::Context> NewLocalContext();
v8::Local<v8::Context> GetPersistentContext();
@@ -186,15 +186,15 @@ class CFXJS_Engine {
v8::Local<v8::Number> NewNumber(double number);
v8::Local<v8::Number> NewNumber(float number);
v8::Local<v8::Boolean> NewBoolean(bool b);
- v8::Local<v8::String> NewString(const CFX_ByteStringC& str);
- v8::Local<v8::String> NewString(const CFX_WideStringC& str);
+ v8::Local<v8::String> NewString(const ByteStringView& str);
+ v8::Local<v8::String> NewString(const WideStringView& str);
v8::Local<v8::Date> NewDate(double d);
v8::Local<v8::Object> NewFxDynamicObj(int nObjDefnID, bool bStatic = false);
int ToInt32(v8::Local<v8::Value> pValue);
bool ToBoolean(v8::Local<v8::Value> pValue);
double ToDouble(v8::Local<v8::Value> pValue);
- CFX_WideString ToWideString(v8::Local<v8::Value> pValue);
+ WideString ToWideString(v8::Local<v8::Value> pValue);
v8::Local<v8::Object> ToObject(v8::Local<v8::Value> pValue);
v8::Local<v8::Array> ToArray(v8::Local<v8::Value> pValue);
@@ -207,12 +207,11 @@ class CFXJS_Engine {
v8::Local<v8::Value> pValue);
// Objects.
- std::vector<CFX_WideString> GetObjectPropertyNames(
- v8::Local<v8::Object> pObj);
+ std::vector<WideString> GetObjectPropertyNames(v8::Local<v8::Object> pObj);
v8::Local<v8::Value> GetObjectProperty(v8::Local<v8::Object> pObj,
- const CFX_WideString& PropertyName);
+ const WideString& PropertyName);
void PutObjectProperty(v8::Local<v8::Object> pObj,
- const CFX_WideString& PropertyName,
+ const WideString& PropertyName,
v8::Local<v8::Value> pValue);
// Native object binding.
@@ -221,10 +220,10 @@ class CFXJS_Engine {
static void FreeObjectPrivate(void* p);
static void FreeObjectPrivate(v8::Local<v8::Object> pObj);
- void SetConstArray(const CFX_WideString& name, v8::Local<v8::Array> array);
- v8::Local<v8::Array> GetConstArray(const CFX_WideString& name);
+ void SetConstArray(const WideString& name, v8::Local<v8::Array> array);
+ v8::Local<v8::Array> GetConstArray(const WideString& name);
- void Error(const CFX_WideString& message);
+ void Error(const WideString& message);
protected:
CFXJS_Engine();
@@ -235,7 +234,7 @@ class CFXJS_Engine {
v8::Isolate* m_isolate;
v8::Global<v8::Context> m_V8PersistentContext;
std::vector<v8::Global<v8::Object>*> m_StaticObjects;
- std::map<CFX_WideString, v8::Global<v8::Array>> m_ConstArrays;
+ std::map<WideString, v8::Global<v8::Array>> m_ConstArrays;
};
#endif // FXJS_FXJS_V8_H_
diff --git a/fxjs/fxjs_v8_embeddertest.cpp b/fxjs/fxjs_v8_embeddertest.cpp
index 5a8ee63bea..53fe8f268b 100644
--- a/fxjs/fxjs_v8_embeddertest.cpp
+++ b/fxjs/fxjs_v8_embeddertest.cpp
@@ -19,7 +19,7 @@ const wchar_t kScript2[] = L"fred = 8";
class FXJSV8EmbedderTest : public JSEmbedderTest {
public:
- void ExecuteInCurrentContext(const CFX_WideString& script) {
+ void ExecuteInCurrentContext(const WideString& script) {
FXJSErr error;
int sts = engine()->Execute(script, &error);
EXPECT_EQ(0, sts);
@@ -37,7 +37,7 @@ TEST_F(FXJSV8EmbedderTest, Getters) {
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
- ExecuteInCurrentContext(CFX_WideString(kScript1));
+ ExecuteInCurrentContext(WideString(kScript1));
CheckAssignmentInCurrentContext(kExpected1);
}
@@ -52,13 +52,13 @@ TEST_F(FXJSV8EmbedderTest, MultipleEngines) {
engine2.InitializeEngine();
v8::Context::Scope context_scope(GetV8Context());
- ExecuteInCurrentContext(CFX_WideString(kScript0));
+ ExecuteInCurrentContext(WideString(kScript0));
CheckAssignmentInCurrentContext(kExpected0);
{
v8::Local<v8::Context> context1 = engine1.NewLocalContext();
v8::Context::Scope context_scope1(context1);
- ExecuteInCurrentContext(CFX_WideString(kScript1));
+ ExecuteInCurrentContext(WideString(kScript1));
CheckAssignmentInCurrentContext(kExpected1);
}
@@ -67,7 +67,7 @@ TEST_F(FXJSV8EmbedderTest, MultipleEngines) {
{
v8::Local<v8::Context> context2 = engine2.NewLocalContext();
v8::Context::Scope context_scope2(context2);
- ExecuteInCurrentContext(CFX_WideString(kScript2));
+ ExecuteInCurrentContext(WideString(kScript2));
CheckAssignmentInCurrentContext(kExpected2);
}
diff --git a/fxjs/fxjse.h b/fxjs/fxjse.h
index 8fc514bba3..48648130ab 100644
--- a/fxjs/fxjse.h
+++ b/fxjs/fxjse.h
@@ -31,16 +31,16 @@ class CFXJSE_HostObject {
};
typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis,
- const CFX_ByteStringC& szFuncName,
+ const ByteStringView& szFuncName,
CFXJSE_Arguments& args);
typedef void (*FXJSE_PropAccessor)(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
CFXJSE_Value* pValue);
typedef int32_t (*FXJSE_PropTypeGetter)(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName,
+ const ByteStringView& szPropName,
bool bQueryIn);
typedef bool (*FXJSE_PropDeleter)(CFXJSE_Value* pObject,
- const CFX_ByteStringC& szPropName);
+ const ByteStringView& szPropName);
enum FXJSE_ClassPropTypes {
FXJSE_ClassPropType_None,
@@ -79,6 +79,6 @@ void FXJSE_Finalize();
v8::Isolate* FXJSE_Runtime_Create_Own();
void FXJSE_Runtime_Release(v8::Isolate* pIsolate);
-void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message);
+void FXJSE_ThrowMessage(const ByteStringView& utf8Message);
#endif // FXJS_FXJSE_H_
diff --git a/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc b/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc
index e791102103..3334e86bfc 100644
--- a/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc
+++ b/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc
@@ -27,8 +27,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
barcode.SetHeight(298);
barcode.SetWidth(418);
- CFX_WideStringC content(reinterpret_cast<const wchar_t*>(data),
- size / sizeof(wchar_t));
+ WideStringView content(reinterpret_cast<const wchar_t*>(data),
+ size / sizeof(wchar_t));
if (!barcode.Encode(content))
return 0;
diff --git a/testing/libfuzzer/pdf_css_fuzzer.cc b/testing/libfuzzer/pdf_css_fuzzer.cc
index 36b29427ef..74745a20be 100644
--- a/testing/libfuzzer/pdf_css_fuzzer.cc
+++ b/testing/libfuzzer/pdf_css_fuzzer.cc
@@ -11,8 +11,8 @@
#include "core/fxcrt/fx_string.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- CFX_WideString input = CFX_WideString::FromUTF8(
- CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
+ WideString input =
+ WideString::FromUTF8(ByteStringView(data, static_cast<FX_STRSIZE>(size)));
// If we convert the input into an empty string bail out.
if (input.GetLength() == 0)
diff --git a/testing/libfuzzer/pdf_fm2js_fuzzer.cc b/testing/libfuzzer/pdf_fm2js_fuzzer.cc
index de5610677f..438d1025ad 100644
--- a/testing/libfuzzer/pdf_fm2js_fuzzer.cc
+++ b/testing/libfuzzer/pdf_fm2js_fuzzer.cc
@@ -16,8 +16,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return 0;
CFX_WideTextBuf js;
- CFX_WideString input =
- CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie()));
- CXFA_FM2JSContext::Translate(input.AsStringC(), &js);
+ WideString input =
+ WideString::FromUTF8(ByteStringView(data, safe_size.ValueOrDie()));
+ CXFA_FM2JSContext::Translate(input.AsStringView(), &js);
return 0;
}
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index 0ebb7478c2..b32ec7de96 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -105,8 +105,8 @@ std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename,
}
std::string GetPlatformString(FPDF_WIDESTRING wstr) {
- CFX_WideString wide_string =
- CFX_WideString::FromUTF16LE(wstr, CFX_WideString::WStringLength(wstr));
+ WideString wide_string =
+ WideString::FromUTF16LE(wstr, WideString::WStringLength(wstr));
return std::string(wide_string.UTF8Encode().c_str());
}
diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp
index a11806ffda..3aee49c580 100644
--- a/testing/xfa_js_embedder_test.cpp
+++ b/testing/xfa_js_embedder_test.cpp
@@ -52,7 +52,7 @@ bool XFAJSEmbedderTest::OpenDocument(const std::string& filename,
return true;
}
-bool XFAJSEmbedderTest::Execute(const CFX_ByteStringC& input) {
+bool XFAJSEmbedderTest::Execute(const ByteStringView& input) {
if (ExecuteHelper(input)) {
return true;
}
@@ -68,13 +68,13 @@ bool XFAJSEmbedderTest::Execute(const CFX_ByteStringC& input) {
return false;
}
-bool XFAJSEmbedderTest::ExecuteSilenceFailure(const CFX_ByteStringC& input) {
+bool XFAJSEmbedderTest::ExecuteSilenceFailure(const ByteStringView& input) {
return ExecuteHelper(input);
}
-bool XFAJSEmbedderTest::ExecuteHelper(const CFX_ByteStringC& input) {
+bool XFAJSEmbedderTest::ExecuteHelper(const ByteStringView& input) {
value_ = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
return script_context_->RunScript(XFA_SCRIPTLANGTYPE_Formcalc,
- CFX_WideString::FromUTF8(input).AsStringC(),
+ WideString::FromUTF8(input).AsStringView(),
value_.get(), GetXFADocument()->GetRoot());
}
diff --git a/testing/xfa_js_embedder_test.h b/testing/xfa_js_embedder_test.h
index 1dc06f05e6..362db471ce 100644
--- a/testing/xfa_js_embedder_test.h
+++ b/testing/xfa_js_embedder_test.h
@@ -32,8 +32,8 @@ class XFAJSEmbedderTest : public EmbedderTest {
v8::Isolate* GetIsolate() const { return isolate_; }
CXFA_Document* GetXFADocument();
- bool Execute(const CFX_ByteStringC& input);
- bool ExecuteSilenceFailure(const CFX_ByteStringC& input);
+ bool Execute(const ByteStringView& input);
+ bool ExecuteSilenceFailure(const ByteStringView& input);
CFXJSE_Value* GetValue() const { return value_.get(); }
@@ -43,7 +43,7 @@ class XFAJSEmbedderTest : public EmbedderTest {
v8::Isolate* isolate_;
CXFA_ScriptContext* script_context_;
- bool ExecuteHelper(const CFX_ByteStringC& input);
+ bool ExecuteHelper(const ByteStringView& input);
};
#endif // TESTING_XFA_JS_EMBEDDER_TEST_H_
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(&currentTime);
struct tm* pTmStruct = gmtime(&currentTime);
- 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);