Deprecate "encoding" parameter of wxXmlDocument ctor and Load()

This parameter wasn't used for anything as it specified the encoding of
the data contents in memory and not the encoding of the XML file as
might be believed, so it only created unnecessary confusion.

See #24167.
This commit is contained in:
Vadim Zeitlin 2024-01-01 21:00:50 +01:00
parent 9ee9f4e8dd
commit 20845d85a5
7 changed files with 53 additions and 38 deletions

View file

@ -229,10 +229,8 @@ class WXDLLIMPEXP_XML wxXmlDocument : public wxObject
{
public:
wxXmlDocument();
wxXmlDocument(const wxString& filename,
const wxString& encoding = wxT("UTF-8"));
wxXmlDocument(wxInputStream& stream,
const wxString& encoding = wxT("UTF-8"));
wxXmlDocument(const wxString& filename);
wxXmlDocument(wxInputStream& stream);
~wxXmlDocument() = default;
wxXmlDocument(const wxXmlDocument& doc);
@ -240,10 +238,8 @@ public:
// Parses .xml file and loads data. Returns TRUE on success, FALSE
// otherwise.
virtual bool Load(const wxString& filename,
const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE);
virtual bool Load(wxInputStream& stream,
const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE);
bool Load(const wxString& filename, int flags = wxXMLDOC_NONE);
bool Load(wxInputStream& stream, int flags = wxXMLDOC_NONE);
// Saves document as .xml file.
virtual bool Save(const wxString& filename, int indentstep = 2) const;
@ -281,6 +277,36 @@ public:
static wxVersionInfo GetLibraryVersionInfo();
#ifdef WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("Remove encoding parameter from the call")
wxXmlDocument(const wxString& filename,
const wxString& WXUNUSED(encoding))
: wxXmlDocument(filename)
{
}
wxDEPRECATED_MSG("Remove encoding parameter from the call")
wxXmlDocument(wxInputStream& stream,
const wxString& WXUNUSED(encoding))
: wxXmlDocument(stream)
{
}
wxDEPRECATED_MSG("Remove encoding parameter from the call")
bool Load(const wxString& filename,
const wxString& WXUNUSED(encoding), int flags = wxXMLDOC_NONE)
{
return Load(filename, flags);
}
wxDEPRECATED_MSG("Remove encoding parameter from the call")
bool Load(wxInputStream& stream,
const wxString& WXUNUSED(encoding), int flags = wxXMLDOC_NONE)
{
return Load(stream, flags);
}
#endif // WXWIN_COMPATIBILITY_3_2
private:
wxString m_version;
wxString m_fileEncoding;