diff options
author | Neil <nyamatongwe@gmail.com> | 2021-04-05 19:34:13 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-04-05 19:34:13 +1000 |
commit | 0f1f537fd035be38e7f93cba998dc75aaf90763d (patch) | |
tree | f82f3a863b01635873186180382a40872d9feecb /src/PositionCache.cxx | |
parent | bada09f1e1634ac00eed3f23c4f748b1897de96a (diff) | |
download | scintilla-mirror-0f1f537fd035be38e7f93cba998dc75aaf90763d.tar.gz |
Extract unnamed caching enum as LineLayoutCache::Cache and change to enum class.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index c9b886119..7516c82ec 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -357,7 +357,7 @@ XYPOSITION ScreenLine::TabPositionAfter(XYPOSITION xPosition) const { } LineLayoutCache::LineLayoutCache() : - level(0), + level(Cache::none), allInvalidated(false), styleClock(-1), useCount(0) { Allocate(0); } @@ -375,11 +375,11 @@ void LineLayoutCache::Allocate(size_t length_) { void LineLayoutCache::AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesInDoc) { PLATFORM_ASSERT(useCount == 0); size_t lengthForLevel = 0; - if (level == llcCaret) { + if (level == Cache::caret) { lengthForLevel = 1; - } else if (level == llcPage) { + } else if (level == Cache::page) { lengthForLevel = linesOnScreen + 1; - } else if (level == llcDocument) { + } else if (level == Cache::document) { lengthForLevel = linesInDoc; } if (lengthForLevel > cache.size()) { @@ -414,9 +414,9 @@ void LineLayoutCache::Invalidate(LineLayout::ValidLevel validity_) noexcept { } } -void LineLayoutCache::SetLevel(int level_) noexcept { +void LineLayoutCache::SetLevel(Cache level_) noexcept { allInvalidated = false; - if ((level_ != -1) && (level != level_)) { + if ((static_cast<int>(level_) != -1) && (level != level_)) { level = level_; Deallocate(); } @@ -432,15 +432,15 @@ LineLayout *LineLayoutCache::Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, allInvalidated = false; Sci::Position pos = -1; LineLayout *ret = nullptr; - if (level == llcCaret) { + if (level == Cache::caret) { pos = 0; - } else if (level == llcPage) { + } else if (level == Cache::page) { if (lineNumber == lineCaret) { pos = 0; } else if (cache.size() > 1) { pos = 1 + (lineNumber % (cache.size() - 1)); } - } else if (level == llcDocument) { + } else if (level == Cache::document) { pos = lineNumber; } if (pos >= 0) { |