wx/xml: Implement line-ending modes for xml saves

* Add 'wxTextFileType m_fileType' to hold the type
 * Add 'wxString m_eol' to hold the end of lines string

 * Add SetFileType() and GetFileType() to set and get the type
 * Add GetEOL() to get the end of lines wxString

 * Backwards compatibility preserved by using wxTextFileType_Unix

Change-Id: I3e8547b377e2c4060a3a2d97c299a08ea2c0a376
Signed-off-by: Adrian DC <radian.dc@gmail.com>
This commit is contained in:
Adrian DC
2017-05-29 16:08:48 +02:00
parent 2afd8bfcaf
commit 11e5413558
3 changed files with 49 additions and 10 deletions

View File

@@ -18,6 +18,7 @@
#include "wx/string.h"
#include "wx/object.h"
#include "wx/list.h"
#include "wx/textbuf.h"
#include "wx/versioninfo.h"
#ifdef WXMAKINGDLL_XML
@@ -317,6 +318,9 @@ public:
// encoding of in-memory representation!
const wxString& GetFileEncoding() const { return m_fileEncoding; }
const wxXmlDoctype& GetDoctype() const { return m_doctype; }
// Returns file type of document
wxTextFileType GetFileType() const { return m_fileType; }
wxString GetEOL() const { return m_eol; }
// Write-access methods:
wxXmlNode *DetachDocumentNode() { wxXmlNode *old=m_docNode; m_docNode=NULL; return old; }
@@ -326,6 +330,7 @@ public:
void SetVersion(const wxString& version) { m_version = version; }
void SetFileEncoding(const wxString& encoding) { m_fileEncoding = encoding; }
void SetDoctype(const wxXmlDoctype& doctype) { m_doctype = doctype; }
void SetFileType(wxTextFileType fileType);
void AppendToProlog(wxXmlNode *node);
#if !wxUSE_UNICODE
@@ -346,6 +351,8 @@ private:
#endif
wxXmlDoctype m_doctype;
wxXmlNode *m_docNode;
wxTextFileType m_fileType;
wxString m_eol;
void DoCopy(const wxXmlDocument& doc);