diff options
author | nyamatongwe <devnull@localhost> | 2012-05-05 14:00:01 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2012-05-05 14:00:01 +1000 |
commit | ceb8fe2321abf6e61833864996d42a2e9486d14d (patch) | |
tree | c6792ee038178e172bdb0dc73fbd0034b4c040e2 | |
parent | bc5c1d5f9f55dd88ea385d2afea85514da818839 (diff) | |
download | scintilla-mirror-ceb8fe2321abf6e61833864996d42a2e9486d14d.tar.gz |
Replace std::auto_ptr with own code as has been deprecated by C++11.
-rw-r--r-- | src/Editor.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
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<char *>(lParam); int pos; int lengthFound = istrlen(txt); - std::auto_ptr<CaseFolder> 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<CaseFolder> pcf(CaseFolderForEncoding()); + ScopedCaseFolder pcf(CaseFolderForEncoding()); int pos = pdoc->FindText(targetStart, targetEnd, text, (searchFlags & SCFIND_MATCHCASE) != 0, (searchFlags & SCFIND_WHOLEWORD) != 0, |