diff options
author | Neil <nyamatongwe@gmail.com> | 2021-03-18 19:50:34 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-03-18 19:50:34 +1100 |
commit | 6af47b53d52c29474bfc551700f8394dbf1dbc04 (patch) | |
tree | 12306e8c4586c60ebcc64acac5018b570b69605f /src | |
parent | 402e089842d5aa2bb3774a665e26c42dc91fa5b4 (diff) | |
download | scintilla-mirror-6af47b53d52c29474bfc551700f8394dbf1dbc04.tar.gz |
Use unique_ptr for CaseFolderForEncoding to show transfer of ownership.
Diffstat (limited to 'src')
-rw-r--r-- | src/Document.cxx | 4 | ||||
-rw-r--r-- | src/Document.h | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 4 | ||||
-rw-r--r-- | src/Editor.h | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 5f80ee50b..63b90d69f 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1971,8 +1971,8 @@ bool Document::HasCaseFolder() const noexcept { return pcf != nullptr; } -void Document::SetCaseFolder(CaseFolder *pcf_) noexcept { - pcf.reset(pcf_); +void Document::SetCaseFolder(std::unique_ptr<CaseFolder> pcf_) noexcept { + pcf = std::move(pcf_); } Document::CharacterExtracted Document::ExtractCharacter(Sci::Position position) const noexcept { diff --git a/src/Document.h b/src/Document.h index ce0178695..91163713b 100644 --- a/src/Document.h +++ b/src/Document.h @@ -439,7 +439,7 @@ public: bool MatchesWordOptions(bool word, bool wordStart, Sci::Position pos, Sci::Position length) const; bool HasCaseFolder() const noexcept; - void SetCaseFolder(CaseFolder *pcf_) noexcept; + void SetCaseFolder(std::unique_ptr<CaseFolder> pcf_) noexcept; Sci::Position FindText(Sci::Position minPos, Sci::Position maxPos, const char *search, int flags, Sci::Position *length); const char *SubstituteByPosition(const char *text, Sci::Position *length); int LineCharacterIndex() const noexcept; diff --git a/src/Editor.cxx b/src/Editor.cxx index 54336c19f..ab5c9c811 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4057,9 +4057,9 @@ public: }; -CaseFolder *Editor::CaseFolderForEncoding() { +std::unique_ptr<CaseFolder> Editor::CaseFolderForEncoding() { // Simple default that only maps ASCII upper case to lower case. - return new CaseFolderASCII(); + return std::make_unique<CaseFolderASCII>(); } /** diff --git a/src/Editor.h b/src/Editor.h index c08c8288e..548c72ed8 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -481,7 +481,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void Indent(bool forwards); - virtual CaseFolder *CaseFolderForEncoding(); + virtual std::unique_ptr<CaseFolder> CaseFolderForEncoding(); Sci::Position FindText(uptr_t wParam, sptr_t lParam); void SearchAnchor(); Sci::Position SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); |