diff options
author | Neil <nyamatongwe@gmail.com> | 2019-04-08 08:41:47 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2019-04-08 08:41:47 +1000 |
commit | e81d5a59bf0ee796e653616d570f8b93fef1344a (patch) | |
tree | 8b70abcc64f54c361bf8ff7249d3d1b97c3060a4 /src/ViewStyle.cxx | |
parent | 4333970abdd54863a591f95df3c3e7e968aa2519 (diff) | |
download | scintilla-mirror-e81d5a59bf0ee796e653616d570f8b93fef1344a.tar.gz |
Use noexcept where reasonable in ViewStyle.
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r-- | src/ViewStyle.cxx | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index f507c5528..aa3c4e477 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -29,12 +29,11 @@ using namespace Scintilla; -MarginStyle::MarginStyle(int style_, int width_, int mask_) : +MarginStyle::MarginStyle(int style_, int width_, int mask_) noexcept : style(style_), width(width_), mask(mask_), sensitive(false), cursor(SC_CURSORREVERSEARROW) { } -FontRealised::FontRealised() { -} +FontRealised::FontRealised() noexcept = default; FontRealised::~FontRealised() { font.Release(); @@ -348,7 +347,7 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) { textStart = marginInside ? fixedColumnWidth : leftMarginWidth; } -void ViewStyle::ReleaseAllExtendedStyles() { +void ViewStyle::ReleaseAllExtendedStyles() noexcept { nextExtendedStyle = 256; } @@ -394,11 +393,11 @@ void ViewStyle::SetStyleFontName(int styleIndex, const char *name) { styles[styleIndex].fontName = fontNames.Save(name); } -bool ViewStyle::ProtectionActive() const { +bool ViewStyle::ProtectionActive() const noexcept { return someStylesProtected; } -int ViewStyle::ExternalMarginWidth() const { +int ViewStyle::ExternalMarginWidth() const noexcept { return marginInside ? 0 : fixedColumnWidth; } @@ -413,7 +412,7 @@ int ViewStyle::MarginFromLocation(Point pt) const { return margin; } -bool ViewStyle::ValidStyle(size_t styleIndex) const { +bool ViewStyle::ValidStyle(size_t styleIndex) const noexcept { return styleIndex < styles.size(); } @@ -433,11 +432,11 @@ void ViewStyle::CalcLargestMarkerHeight() { } } -int ViewStyle::GetFrameWidth() const { +int ViewStyle::GetFrameWidth() const noexcept { return std::clamp(caretLineFrame, 1, lineHeight / 3); } -bool ViewStyle::IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const { +bool ViewStyle::IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const noexcept { return caretLineFrame && (caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret; } @@ -479,16 +478,16 @@ ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lin return background; } -bool ViewStyle::SelectionBackgroundDrawn() const { +bool ViewStyle::SelectionBackgroundDrawn() const noexcept { return selColours.back.isSet && ((selAlpha == SC_ALPHA_NOALPHA) || (selAdditionalAlpha == SC_ALPHA_NOALPHA)); } -bool ViewStyle::WhitespaceBackgroundDrawn() const { +bool ViewStyle::WhitespaceBackgroundDrawn() const noexcept { return (viewWhitespace != wsInvisible) && (whitespaceColours.back.isSet); } -bool ViewStyle::WhiteSpaceVisible(bool inIndent) const { +bool ViewStyle::WhiteSpaceVisible(bool inIndent) const noexcept { return (!inIndent && viewWhitespace == wsVisibleAfterIndent) || (inIndent && viewWhitespace == wsVisibleOnlyInIndent) || viewWhitespace == wsVisibleAlways; @@ -501,7 +500,7 @@ ColourDesired ViewStyle::WrapColour() const { return styles[STYLE_DEFAULT].fore; } -bool ViewStyle::SetWrapState(int wrapState_) { +bool ViewStyle::SetWrapState(int wrapState_) noexcept { WrapMode wrapStateWanted; switch (wrapState_) { case SC_WRAP_WORD: @@ -522,25 +521,25 @@ bool ViewStyle::SetWrapState(int wrapState_) { return changed; } -bool ViewStyle::SetWrapVisualFlags(int wrapVisualFlags_) { +bool ViewStyle::SetWrapVisualFlags(int wrapVisualFlags_) noexcept { const bool changed = wrapVisualFlags != wrapVisualFlags_; wrapVisualFlags = wrapVisualFlags_; return changed; } -bool ViewStyle::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_) { +bool ViewStyle::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_) noexcept { const bool changed = wrapVisualFlagsLocation != wrapVisualFlagsLocation_; wrapVisualFlagsLocation = wrapVisualFlagsLocation_; return changed; } -bool ViewStyle::SetWrapVisualStartIndent(int wrapVisualStartIndent_) { +bool ViewStyle::SetWrapVisualStartIndent(int wrapVisualStartIndent_) noexcept { const bool changed = wrapVisualStartIndent != wrapVisualStartIndent_; wrapVisualStartIndent = wrapVisualStartIndent_; return changed; } -bool ViewStyle::SetWrapIndentMode(int wrapIndentMode_) { +bool ViewStyle::SetWrapIndentMode(int wrapIndentMode_) noexcept { const bool changed = wrapIndentMode != wrapIndentMode_; wrapIndentMode = wrapIndentMode_; return changed; |