From ceb8fe2321abf6e61833864996d42a2e9486d14d Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 5 May 2012 14:00:01 +1000 Subject: Replace std::auto_ptr with own code as has been deprecated by C++11. --- src/Editor.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index 2fb2ea03f..3d5257059 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5800,6 +5800,19 @@ void Editor::SearchAnchor() { searchAnchor = SelectionStart().Position(); } +// Simple RAII wrapper for CaseFolder as std::auto_ptr is now deprecated +class ScopedCaseFolder { + CaseFolder *pcf; +public: + ScopedCaseFolder(CaseFolder *pcf_) : pcf(pcf_) { + } + ~ScopedCaseFolder() { + delete pcf; + pcf = 0; + } + CaseFolder *get() const { return pcf; } +}; + /** * Find text from current search anchor: Must call @c SearchAnchor first. * Used for next text and previous text requests. @@ -5814,7 +5827,7 @@ long Editor::SearchText( const char *txt = reinterpret_cast(lParam); int pos; int lengthFound = istrlen(txt); - std::auto_ptr pcf(CaseFolderForEncoding()); + ScopedCaseFolder pcf(CaseFolderForEncoding()); if (iMessage == SCI_SEARCHNEXT) { pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, (wParam & SCFIND_MATCHCASE) != 0, @@ -5865,7 +5878,7 @@ std::string Editor::CaseMapString(const std::string &s, int caseMapping) { long Editor::SearchInTarget(const char *text, int length) { int lengthFound = length; - std::auto_ptr pcf(CaseFolderForEncoding()); + ScopedCaseFolder pcf(CaseFolderForEncoding()); int pos = pdoc->FindText(targetStart, targetEnd, text, (searchFlags & SCFIND_MATCHCASE) != 0, (searchFlags & SCFIND_WHOLEWORD) != 0, -- cgit v1.2.3