X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b71e9aa4e2187a7f6469f68812467f2ecb6a3836..d1526a6787a5dc39dd7c07662a355818527041e7:/src/richtext/richtextxml.cpp diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index 84dbc72288..b2205170ed 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: richtext/richtextxml.cpp +// Name: src/richtext/richtextxml.cpp // Purpose: XML and HTML I/O for wxRichTextCtrl // Author: Julian Smart // Modified by: @@ -13,7 +13,7 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop + #pragma hdrstop #endif #if wxUSE_RICHTEXT && wxUSE_XML @@ -21,17 +21,16 @@ #include "wx/richtext/richtextxml.h" #ifndef WX_PRECOMP - #include "wx/wx.h" + #include "wx/intl.h" + #include "wx/module.h" #endif #include "wx/filename.h" #include "wx/clipbrd.h" #include "wx/wfstream.h" #include "wx/sstream.h" -#include "wx/module.h" #include "wx/txtstrm.h" #include "wx/xml/xml.h" -#include "wx/intl.h" IMPLEMENT_DYNAMIC_CLASS(wxRichTextXMLHandler, wxRichTextFileHandler) @@ -123,13 +122,13 @@ bool wxRichTextXMLHandler::ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node) wxString text2 = textChild->GetContent(); // Strip whitespace from end - if (text2.Length() > 0 && text2[text2.Length()-1] == wxT('\n')) - text2 = text2.Mid(0, text2.Length()-1); + if (!text2.empty() && text2[text2.length()-1] == wxT('\n')) + text2 = text2.Mid(0, text2.length()-1); - if (text2.Length() > 0 && text2[0] == wxT('"')) + if (!text2.empty() && text2[0] == wxT('"')) text2 = text2.Mid(1); - if (text2.Length() > 0 && text2[text2.Length()-1] == wxT('"')) - text2 = text2.Mid(0, text2.Length() - 1); + if (!text2.empty() && text2[text2.length()-1] == wxT('"')) + text2 = text2.Mid(0, text2.length() - 1); text += text2; } @@ -175,7 +174,7 @@ bool wxRichTextXMLHandler::ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node) wxStringInputStream strStream(data); - imageObj->GetImageBlock().ReadHex(strStream, data.Length(), imageType); + imageObj->GetImageBlock().ReadHex(strStream, data.length(), imageType); } } child = child->GetNext(); @@ -307,7 +306,7 @@ static void OutputStringEnt(wxOutputStream& stream, const wxString& str, for (i = 0; i < len; i++) { c = str.GetChar(i); - + // Original code excluded "&" but we _do_ want to convert // the ampersand beginning & because otherwise when read in, // the original "&" becomes "&". @@ -388,7 +387,7 @@ bool wxRichTextXMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& #endif // If SetEncoding has been called, change the output encoding. - if (!m_encoding.IsEmpty() && m_encoding.Lower() != fileEncoding.Lower()) + if (!m_encoding.empty() && m_encoding.Lower() != fileEncoding.Lower()) { if (m_encoding == wxT("")) { @@ -400,7 +399,7 @@ bool wxRichTextXMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& } // GetSystemEncodingName may not have returned a name - if (fileEncoding.IsEmpty()) + if (fileEncoding.empty()) #if wxUSE_UNICODE fileEncoding = wxT("UTF-8"); #else @@ -430,7 +429,7 @@ bool wxRichTextXMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& if (deleteConvFile) delete convFile; - + return success; } @@ -461,7 +460,7 @@ bool wxRichTextXMLHandler::ExportXML(wxOutputStream& stream, wxMBConv* convMem, OutputString(stream, style + wxT(">"), convMem, convFile); wxString str = text.GetText(); - if (str.Length() > 0 && (str[0] == wxT(' ') || str[str.Length()-1] == wxT(' '))) + if (!str.empty() && (str[0] == wxT(' ') || str[str.length()-1] == wxT(' '))) { OutputString(stream, wxT("\""), convMem, convFile); OutputStringEnt(stream, str, convMem, convFile); @@ -683,6 +682,6 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is #endif // wxUSE_STREAMS - + #endif // wxUSE_RICHTEXT && wxUSE_XML