aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ScintillaBase.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-08-22 22:14:19 +1000
committerNeil <nyamatongwe@gmail.com>2021-08-22 22:14:19 +1000
commit6f709917a1134aaf55fc83d8a9f18a30b50efd89 (patch)
tree303457f17677c8c92d484b4485e1ec4cfc2499c8 /src/ScintillaBase.cxx
parent557bea24106e3868d2b5c5c4b066575c5236538a (diff)
downloadscintilla-mirror-6f709917a1134aaf55fc83d8a9f18a30b50efd89.tar.gz
Encapsulate an ILexer5* in LexerInstance class to simplify client code.
Diffstat (limited to 'src/ScintillaBase.cxx')
-rw-r--r--src/ScintillaBase.cxx33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index 238299734..b2a15a286 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -550,13 +550,8 @@ namespace Scintilla::Internal {
class LexState : public LexInterface {
public:
explicit LexState(Document *pdoc_) noexcept;
- void SetInstance(ILexer5 *instance_);
- // Deleted so LexState objects can not be copied.
- LexState(const LexState &) = delete;
- LexState(LexState &&) = delete;
- LexState &operator=(const LexState &) = delete;
- LexState &operator=(LexState &&) = delete;
- ~LexState() override;
+
+ // LexInterface deleted the standard operators and defined the virtual destructor so don't need to here.
const char *DescribeWordListSets();
void SetWordList(int n, const char *wl);
@@ -592,30 +587,6 @@ public:
LexState::LexState(Document *pdoc_) noexcept : LexInterface(pdoc_) {
}
-LexState::~LexState() {
- if (instance) {
- try {
- instance->Release();
- } catch (...) {
- // ILexer5::Release must not throw, ignore if it does.
- }
- instance = nullptr;
- }
-}
-
-void LexState::SetInstance(ILexer5 *instance_) {
- if (instance) {
- try {
- instance->Release();
- } catch (...) {
- // ILexer5::Release must not throw, ignore if it does.
- }
- instance = nullptr;
- }
- instance = instance_;
- pdoc->LexerChanged();
-}
-
LexState *ScintillaBase::DocumentLexState() {
if (!pdoc->GetLexInterface()) {
pdoc->SetLexInterface(std::make_unique<LexState>(pdoc));