diff options
-rw-r--r-- | qt/ScintillaEdit/ScintillaDocument.cpp | 4 | ||||
-rw-r--r-- | src/CaseFolder.cxx | 2 | ||||
-rw-r--r-- | src/CaseFolder.h | 2 | ||||
-rw-r--r-- | src/Document.cxx | 2 | ||||
-rw-r--r-- | src/Document.h | 10 | ||||
-rw-r--r-- | src/EditModel.h | 2 | ||||
-rw-r--r-- | src/EditView.cxx | 16 | ||||
-rw-r--r-- | src/EditView.h | 14 | ||||
-rw-r--r-- | src/Editor.cxx | 48 | ||||
-rw-r--r-- | src/Editor.h | 74 | ||||
-rw-r--r-- | src/MarginView.cxx | 2 | ||||
-rw-r--r-- | src/MarginView.h | 2 | ||||
-rw-r--r-- | src/PositionCache.cxx | 24 | ||||
-rw-r--r-- | src/PositionCache.h | 28 |
14 files changed, 115 insertions, 115 deletions
diff --git a/qt/ScintillaEdit/ScintillaDocument.cpp b/qt/ScintillaEdit/ScintillaDocument.cpp index 072f9bd2b..5e158f4a1 100644 --- a/qt/ScintillaEdit/ScintillaDocument.cpp +++ b/qt/ScintillaEdit/ScintillaDocument.cpp @@ -43,7 +43,7 @@ public: void NotifyModifyAttempt(Document *doc, void *userData) override; void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) override; void NotifyModified(Document *doc, DocModification mh, void *userData) override; - void NotifyDeleted(Document *doc, void *userData) override; + void NotifyDeleted(Document *doc, void *userData) noexcept override; void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos); void NotifyLexerChanged(Document *doc, void *userData) override; void NotifyErrorOccurred(Document *doc, void *userData, int status) override; @@ -72,7 +72,7 @@ void WatcherHelper::NotifyModified(Document *, DocModification mh, void *) { mh.linesAdded, mh.line, mh.foldLevelNow, mh.foldLevelPrev); } -void WatcherHelper::NotifyDeleted(Document *, void *) { +void WatcherHelper::NotifyDeleted(Document *, void *) noexcept { } void WatcherHelper::NotifyStyleNeeded(Document *, void *, Sci::Position endPos) { diff --git a/src/CaseFolder.cxx b/src/CaseFolder.cxx index 0fd29c7bb..7db4bb679 100644 --- a/src/CaseFolder.cxx +++ b/src/CaseFolder.cxx @@ -41,7 +41,7 @@ void CaseFolderTable::SetTranslation(char ch, char chTranslation) { mapping[static_cast<unsigned char>(ch)] = chTranslation; } -void CaseFolderTable::StandardASCII() { +void CaseFolderTable::StandardASCII() noexcept { for (size_t iChar=0; iChar<sizeof(mapping); iChar++) { if (iChar >= 'A' && iChar <= 'Z') { mapping[iChar] = static_cast<char>(iChar - 'A' + 'a'); diff --git a/src/CaseFolder.h b/src/CaseFolder.h index 5fa65870e..eb852a491 100644 --- a/src/CaseFolder.h +++ b/src/CaseFolder.h @@ -24,7 +24,7 @@ public: ~CaseFolderTable() override; size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; void SetTranslation(char ch, char chTranslation); - void StandardASCII(); + void StandardASCII() noexcept; }; class ICaseConverter; diff --git a/src/Document.cxx b/src/Document.cxx index 53c5280db..86f8b7a38 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -476,7 +476,7 @@ void Document::ClearLevels() { Levels()->ClearLevels(); } -static bool IsSubordinate(int levelStart, int levelTry) { +static bool IsSubordinate(int levelStart, int levelTry) noexcept { if (levelTry & SC_FOLDLEVELWHITEFLAG) return true; else diff --git a/src/Document.h b/src/Document.h index a50fcac70..2a546847b 100644 --- a/src/Document.h +++ b/src/Document.h @@ -126,11 +126,11 @@ struct StyledText { class HighlightDelimiter { public: - HighlightDelimiter() : isEnabled(false) { + HighlightDelimiter() noexcept : isEnabled(false) { Clear(); } - void Clear() { + void Clear() noexcept { beginFoldBlock = -1; endFoldBlock = -1; firstChangeableLineBefore = -1; @@ -174,13 +174,13 @@ protected: ILexer *instance; bool performingStyle; ///< Prevent reentrance public: - explicit LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(nullptr), performingStyle(false) { + explicit LexInterface(Document *pdoc_) noexcept : pdoc(pdoc_), instance(nullptr), performingStyle(false) { } virtual ~LexInterface() { } void Colourise(Sci::Position start, Sci::Position end); virtual int LineEndTypesSupported(); - bool UseContainerLexing() const { + bool UseContainerLexing() const noexcept { return instance == nullptr; } }; @@ -578,7 +578,7 @@ public: virtual void NotifyModifyAttempt(Document *doc, void *userData) = 0; virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0; virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0; - virtual void NotifyDeleted(Document *doc, void *userData) = 0; + virtual void NotifyDeleted(Document *doc, void *userData) noexcept = 0; virtual void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos) = 0; virtual void NotifyLexerChanged(Document *doc, void *userData) = 0; virtual void NotifyErrorOccurred(Document *doc, void *userData, int status) = 0; diff --git a/src/EditModel.h b/src/EditModel.h index da89c9198..5cc9d51d1 100644 --- a/src/EditModel.h +++ b/src/EditModel.h @@ -60,7 +60,7 @@ public: virtual Sci::Line TopLineOfMain() const = 0; virtual Point GetVisibleOriginInMain() const = 0; virtual Sci::Line LinesOnScreen() const = 0; - virtual Range GetHotSpotRange() const = 0; + virtual Range GetHotSpotRange() const noexcept = 0; }; } diff --git a/src/EditView.cxx b/src/EditView.cxx index 31885ba62..24be8b974 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -63,7 +63,7 @@ static inline bool IsControlCharacter(int ch) { return ch >= 0 && ch < ' '; } -PrintParameters::PrintParameters() { +PrintParameters::PrintParameters() noexcept { magnification = 0; colourMode = SC_PRINT_NORMAL; wrapState = eWrapWord; @@ -193,25 +193,25 @@ EditView::EditView() { EditView::~EditView() { } -bool EditView::SetTwoPhaseDraw(bool twoPhaseDraw) { +bool EditView::SetTwoPhaseDraw(bool twoPhaseDraw) noexcept { const PhasesDraw phasesDrawNew = twoPhaseDraw ? phasesTwo : phasesOne; const bool redraw = phasesDraw != phasesDrawNew; phasesDraw = phasesDrawNew; return redraw; } -bool EditView::SetPhasesDraw(int phases) { +bool EditView::SetPhasesDraw(int phases) noexcept { const PhasesDraw phasesDrawNew = static_cast<PhasesDraw>(phases); const bool redraw = phasesDraw != phasesDrawNew; phasesDraw = phasesDrawNew; return redraw; } -bool EditView::LinesOverlap() const { +bool EditView::LinesOverlap() const noexcept { return phasesDraw == phasesMultiple; } -void EditView::ClearAllTabstops() { +void EditView::ClearAllTabstops() noexcept { ldTabstops.reset(); } @@ -279,7 +279,7 @@ void EditView::AllocateGraphics(const ViewStyle &vsDraw) { pixmapIndentGuideHighlight.reset(Surface::Allocate(vsDraw.technology)); } -static const char *ControlCharacterString(unsigned char ch) { +static const char *ControlCharacterString(unsigned char ch) noexcept { const char * const reps[] = { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", @@ -762,7 +762,7 @@ Sci::Position EditView::StartEndDisplayLine(Surface *surface, const EditModel &m return posRet; } -static ColourDesired SelectionBackground(const ViewStyle &vsDraw, bool main, bool primarySelection) { +static ColourDesired SelectionBackground(const ViewStyle &vsDraw, bool main, bool primarySelection) noexcept { return main ? (primarySelection ? vsDraw.selColours.back : vsDraw.selBackground2) : vsDraw.selAdditionalBackground; @@ -2198,7 +2198,7 @@ void EditView::FillLineRemainder(Surface *surface, const EditModel &model, const // Space (3 space characters) between line numbers and text when printing. #define lineNumberPrintSpace " " -static ColourDesired InvertedLight(ColourDesired orig) { +static ColourDesired InvertedLight(ColourDesired orig) noexcept { unsigned int r = orig.GetRed(); unsigned int g = orig.GetGreen(); unsigned int b = orig.GetBlue(); diff --git a/src/EditView.h b/src/EditView.h index 300dc92a9..3addfbab8 100644 --- a/src/EditView.h +++ b/src/EditView.h @@ -14,7 +14,7 @@ struct PrintParameters { int magnification; int colourMode; WrapMode wrapState; - PrintParameters(); + PrintParameters() noexcept; }; /** @@ -97,11 +97,11 @@ public: void operator=(EditView &&) = delete; virtual ~EditView(); - bool SetTwoPhaseDraw(bool twoPhaseDraw); - bool SetPhasesDraw(int phases); - bool LinesOverlap() const; + bool SetTwoPhaseDraw(bool twoPhaseDraw) noexcept; + bool SetPhasesDraw(int phases) noexcept; + bool LinesOverlap() const noexcept; - void ClearAllTabstops(); + void ClearAllTabstops() noexcept; XYPOSITION NextTabstopPos(Sci::Line line, XYPOSITION x, XYPOSITION tabWidth) const; bool ClearTabstops(Sci::Line line); bool AddTabstop(Sci::Line line, int x); @@ -165,7 +165,7 @@ public: AutoLineLayout(AutoLineLayout &&) = delete; AutoLineLayout &operator=(const AutoLineLayout &) = delete; AutoLineLayout &operator=(AutoLineLayout &&) = delete; - ~AutoLineLayout() { + ~AutoLineLayout() noexcept { llc.Dispose(ll); ll = nullptr; } @@ -175,7 +175,7 @@ public: operator LineLayout *() const noexcept { return ll; } - void Set(LineLayout *ll_) { + void Set(LineLayout *ll_) noexcept { llc.Dispose(ll); ll = ll_; } diff --git a/src/Editor.cxx b/src/Editor.cxx index 90520856f..a89b83489 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -62,7 +62,7 @@ using namespace Scintilla; return whether this modification represents an operation that may reasonably be deferred (not done now OR [possibly] at all) */ -static bool CanDeferToLastStep(const DocModification &mh) { +static bool CanDeferToLastStep(const DocModification &mh) noexcept { if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) return true; // CAN skip if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) @@ -72,7 +72,7 @@ static bool CanDeferToLastStep(const DocModification &mh) { return false; // PRESUMABLY must do } -static bool CanEliminate(const DocModification &mh) { +static bool CanEliminate(const DocModification &mh) noexcept { return (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; } @@ -81,7 +81,7 @@ static bool CanEliminate(const DocModification &mh) { return whether this modification represents the FINAL step in a [possibly lengthy] multi-step Undo/Redo sequence */ -static bool IsLastStep(const DocModification &mh) { +static bool IsLastStep(const DocModification &mh) noexcept { return (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 @@ -89,13 +89,13 @@ static bool IsLastStep(const DocModification &mh) { && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; } -Timer::Timer() : +Timer::Timer() noexcept : ticking(false), ticksToWait(0), tickerID{} {} -Idler::Idler() : +Idler::Idler() noexcept : state(false), idlerID(0) {} -static inline bool IsAllSpacesOrTabs(const char *s, unsigned int len) { +static inline bool IsAllSpacesOrTabs(const char *s, unsigned int len) noexcept { for (unsigned int i = 0; i < len; i++) { // This is safe because IsSpaceOrTab() will return false for null terminators if (!IsSpaceOrTab(s[i])) @@ -1464,7 +1464,7 @@ void Editor::NotifyCaretMove() { void Editor::UpdateSystemCaret() { } -bool Editor::Wrapping() const { +bool Editor::Wrapping() const noexcept { return vs.wrapState != eWrapNone; } @@ -1613,7 +1613,7 @@ void Editor::LinesJoin() { } } -const char *Editor::StringFromEOLMode(int eolMode) { +const char *Editor::StringFromEOLMode(int eolMode) noexcept { if (eolMode == SC_EOL_CRLF) { return "\r\n"; } else if (eolMode == SC_EOL_CR) { @@ -2521,7 +2521,7 @@ void Editor::CheckModificationForWrap(DocModification mh) { } // Move a position so it is still after the same character as before the insertion. -static inline Sci::Position MovePositionForInsertion(Sci::Position position, Sci::Position startInsertion, Sci::Position length) { +static inline Sci::Position MovePositionForInsertion(Sci::Position position, Sci::Position startInsertion, Sci::Position length) noexcept { if (position > startInsertion) { return position + length; } @@ -2530,7 +2530,7 @@ static inline Sci::Position MovePositionForInsertion(Sci::Position position, Sci // Move a position so it is still after the same character as before the deletion if that // character is still present else after the previous surviving character. -static inline Sci::Position MovePositionForDeletion(Sci::Position position, Sci::Position startDeletion, Sci::Position length) { +static inline Sci::Position MovePositionForDeletion(Sci::Position position, Sci::Position startDeletion, Sci::Position length) noexcept { if (position > startDeletion) { const Sci::Position endDeletion = startDeletion + length; if (position > endDeletion) { @@ -2711,7 +2711,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { } } -void Editor::NotifyDeleted(Document *, void *) { +void Editor::NotifyDeleted(Document *, void *) noexcept { /* Do nothing */ } @@ -2847,7 +2847,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar } // Something has changed that the container should know about -void Editor::ContainerNeedsUpdate(int flags) { +void Editor::ContainerNeedsUpdate(int flags) noexcept { needUpdateUI |= flags; } @@ -3231,7 +3231,7 @@ constexpr short LowShortFromWParam(uptr_t x) { return static_cast<short>(x & 0xffff); } -unsigned int WithExtends(unsigned int iMessage) { +unsigned int WithExtends(unsigned int iMessage) noexcept { switch (iMessage) { case SCI_CHARLEFT: return SCI_CHARLEFTEXTEND; case SCI_CHARRIGHT: return SCI_CHARRIGHTEXTEND; @@ -3258,7 +3258,7 @@ unsigned int WithExtends(unsigned int iMessage) { } } -int NaturalDirection(unsigned int iMessage) { +int NaturalDirection(unsigned int iMessage) noexcept { switch (iMessage) { case SCI_CHARLEFT: case SCI_CHARLEFTEXTEND: @@ -3289,7 +3289,7 @@ int NaturalDirection(unsigned int iMessage) { } } -bool IsRectExtend(unsigned int iMessage, bool isRectMoveExtends) { +bool IsRectExtend(unsigned int iMessage, bool isRectMoveExtends) noexcept { switch (iMessage) { case SCI_CHARLEFTRECTEXTEND: case SCI_CHARRIGHTRECTEXTEND: @@ -4015,7 +4015,7 @@ void Editor::Indent(bool forwards) { class CaseFolderASCII : public CaseFolderTable { public: - CaseFolderASCII() { + CaseFolderASCII() noexcept { StandardASCII(); } ~CaseFolderASCII() override { @@ -4160,7 +4160,7 @@ void Editor::GoToLine(Sci::Line lineNo) { EnsureCaretVisible(); } -static bool Close(Point pt1, Point pt2, Point threshold) { +static bool Close(Point pt1, Point pt2, Point threshold) noexcept { if (std::abs(pt1.x - pt2.x) > threshold.x) return false; if (std::abs(pt1.y - pt2.y) > threshold.y) @@ -4383,7 +4383,7 @@ bool Editor::PointInSelMargin(Point pt) const { } } -Window::Cursor Editor::GetMarginCursor(Point pt) const { +Window::Cursor Editor::GetMarginCursor(Point pt) const noexcept { int x = 0; for (const MarginStyle &m : vs.ms) { if ((pt.x >= x) && (pt.x < x + m.width)) @@ -4730,7 +4730,7 @@ void Editor::SetHotSpotRange(const Point *pt) { } } -Range Editor::GetHotSpotRange() const { +Range Editor::GetHotSpotRange() const noexcept { return hotspot; } @@ -5572,11 +5572,11 @@ Sci::Position Editor::ReplaceTarget(bool replacePatterns, const char *text, Sci: return length; } -bool Editor::IsUnicodeMode() const { +bool Editor::IsUnicodeMode() const noexcept { return pdoc && (SC_CP_UTF8 == pdoc->dbcsCodePage); } -int Editor::CodePage() const { +int Editor::CodePage() const noexcept { if (pdoc) return pdoc->dbcsCodePage; else @@ -5612,7 +5612,7 @@ void Editor::AddStyledText(const char *buffer, Sci::Position appendLength) { SetEmptySelection(sel.MainCaret() + lengthInserted); } -bool Editor::ValidMargin(uptr_t wParam) const { +bool Editor::ValidMargin(uptr_t wParam) const noexcept { return wParam < vs.ms.size(); } @@ -5741,7 +5741,7 @@ void Editor::SetSelectionNMessage(unsigned int iMessage, uptr_t wParam, sptr_t l ContainerNeedsUpdate(SC_UPDATE_SELECTION); } -sptr_t Editor::StringResult(sptr_t lParam, const char *val) { +sptr_t Editor::StringResult(sptr_t lParam, const char *val) noexcept { const size_t len = val ? strlen(val) : 0; if (lParam) { char *ptr = CharPtrFromSPtr(lParam); @@ -5753,7 +5753,7 @@ sptr_t Editor::StringResult(sptr_t lParam, const char *val) { return len; // Not including NUL } -sptr_t Editor::BytesResult(sptr_t lParam, const unsigned char *val, size_t len) { +sptr_t Editor::BytesResult(sptr_t lParam, const unsigned char *val, size_t len) noexcept { // No NUL termination: len is number of valid/displayed bytes if ((lParam) && (len > 0)) { char *ptr = CharPtrFromSPtr(lParam); diff --git a/src/Editor.h b/src/Editor.h index 55b6f56aa..29150276a 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -19,7 +19,7 @@ public: enum {tickSize = 100}; TickerID tickerID; - Timer(); + Timer() noexcept; }; /** @@ -29,7 +29,7 @@ public: bool state; IdlerID idlerID; - Idler(); + Idler() noexcept; }; /** @@ -47,12 +47,12 @@ public: enum workItems items; Sci::Position upTo; - WorkNeeded() : items(workNone), upTo(0) {} - void Reset() { + WorkNeeded() noexcept : items(workNone), upTo(0) {} + void Reset() noexcept { items = workNone; upTo = 0; } - void Need(workItems items_, Sci::Position pos) { + void Need(workItems items_, Sci::Position pos) noexcept { if ((items_ & workStyle) && (upTo < pos)) upTo = pos; items = static_cast<workItems>(items | items_); @@ -69,8 +69,8 @@ public: bool lineCopy; int codePage; int characterSet; - SelectionText() : rectangular(false), lineCopy(false), codePage(0), characterSet(0) {} - void Clear() { + SelectionText() noexcept : rectangular(false), lineCopy(false), codePage(0), characterSet(0) {} + void Clear() noexcept { s.clear(); rectangular = false; lineCopy = false; @@ -88,16 +88,16 @@ public: void Copy(const SelectionText &other) { Copy(other.s, other.codePage, other.characterSet, other.rectangular, other.lineCopy); } - const char *Data() const { + const char *Data() const noexcept { return s.c_str(); } - size_t Length() const { + size_t Length() const noexcept { return s.length(); } - size_t LengthWithTerminator() const { + size_t LengthWithTerminator() const noexcept { return s.length() + 1; } - bool Empty() const { + bool Empty() const noexcept { return s.empty(); } private: @@ -113,22 +113,22 @@ struct WrapPending { enum { lineLarge = 0x7ffffff }; Sci::Line start; // When there are wraps pending, will be in document range Sci::Line end; // May be lineLarge to indicate all of document after start - WrapPending() { + WrapPending() noexcept { start = lineLarge; end = lineLarge; } - void Reset() { + void Reset() noexcept { start = lineLarge; end = lineLarge; } - void Wrapped(Sci::Line line) { + void Wrapped(Sci::Line line) noexcept { if (start == line) start++; } - bool NeedsWrap() const { + bool NeedsWrap() const noexcept { return start < end; } - bool AddRange(Sci::Line lineStart, Sci::Line lineEnd) { + bool AddRange(Sci::Line lineStart, Sci::Line lineEnd) noexcept { const bool neededWrap = NeedsWrap(); bool changed = false; if (start > lineStart) { @@ -302,7 +302,7 @@ protected: // ScintillaBase subclass needs access to much of Editor PRectangle RectangleFromRange(Range r, int overlap); void InvalidateRange(Sci::Position start, Sci::Position end); - bool UserVirtualSpace() const { + bool UserVirtualSpace() const noexcept { return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0); } Sci::Position CurrentPosition() const; @@ -347,8 +347,8 @@ protected: // ScintillaBase subclass needs access to much of Editor struct XYScrollPosition { int xOffset; Sci::Line topLine; - XYScrollPosition(int xOffset_, Sci::Line topLine_) : xOffset(xOffset_), topLine(topLine_) {} - bool operator==(const XYScrollPosition &other) const { + XYScrollPosition(int xOffset_, Sci::Line topLine_) noexcept : xOffset(xOffset_), topLine(topLine_) {} + bool operator==(const XYScrollPosition &other) const noexcept { return (xOffset == other.xOffset) && (topLine == other.topLine); } }; @@ -368,7 +368,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void NotifyCaretMove(); virtual void UpdateSystemCaret(); - bool Wrapping() const; + bool Wrapping() const noexcept; void NeedWrapping(Sci::Line docLineStart=0, Sci::Line docLineEnd=WrapPending::lineLarge); bool WrapOneLine(Surface *surface, Sci::Line lineToWrap); enum class WrapScope {wsAll, wsVisible, wsIdle}; @@ -441,13 +441,13 @@ protected: // ScintillaBase subclass needs access to much of Editor void NotifySavePoint(Document *document, void *userData, bool atSavePoint) override; void CheckModificationForWrap(DocModification mh); void NotifyModified(Document *document, DocModification mh, void *userData) override; - void NotifyDeleted(Document *document, void *userData) override; + void NotifyDeleted(Document *document, void *userData) noexcept override; void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endStyleNeeded) override; void NotifyLexerChanged(Document *doc, void *userData) override; void NotifyErrorOccurred(Document *doc, void *userData, int status) override; void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - void ContainerNeedsUpdate(int flags); + void ContainerNeedsUpdate(int flags) noexcept; void PageMove(int direction, Selection::selTypes selt=Selection::noSel, bool stuttered = false); enum { cmSame, cmUpper, cmLower }; virtual std::string CaseMapString(const std::string &s, int caseMapping); @@ -495,7 +495,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool PositionInSelection(Sci::Position pos); bool PointInSelection(Point pt); bool PointInSelMargin(Point pt) const; - Window::Cursor GetMarginCursor(Point pt) const; + Window::Cursor GetMarginCursor(Point pt) const noexcept; void TrimAndSetSelection(Sci::Position currentPos_, Sci::Position anchor_); void LineSelection(Sci::Position lineCurrentPos_, Sci::Position lineAnchorPos_, bool wholeLine); void WordSelection(Sci::Position pos); @@ -552,52 +552,52 @@ protected: // ScintillaBase subclass needs access to much of Editor bool PositionIsHotspot(Sci::Position position) const; bool PointIsHotspot(Point pt); void SetHotSpotRange(const Point *pt); - Range GetHotSpotRange() const override; + Range GetHotSpotRange() const noexcept override; void SetHoverIndicatorPosition(Sci::Position position); void SetHoverIndicatorPoint(Point pt); - int CodePage() const; + int CodePage() const noexcept; virtual bool ValidCodePage(int /* codePage */) const { return true; } Sci::Line WrapCount(Sci::Line line); void AddStyledText(const char *buffer, Sci::Position appendLength); virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; - bool ValidMargin(uptr_t wParam) const; + bool ValidMargin(uptr_t wParam) const noexcept; void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); void SetSelectionNMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - static const char *StringFromEOLMode(int eolMode); + static const char *StringFromEOLMode(int eolMode) noexcept; // Coercion functions for transforming WndProc parameters into pointers - static void *PtrFromSPtr(sptr_t lParam) { + static void *PtrFromSPtr(sptr_t lParam) noexcept { return reinterpret_cast<void *>(lParam); } - static const char *ConstCharPtrFromSPtr(sptr_t lParam) { + static const char *ConstCharPtrFromSPtr(sptr_t lParam) noexcept { return static_cast<const char *>(PtrFromSPtr(lParam)); } - static const unsigned char *ConstUCharPtrFromSPtr(sptr_t lParam) { + static const unsigned char *ConstUCharPtrFromSPtr(sptr_t lParam) noexcept { return static_cast<const unsigned char *>(PtrFromSPtr(lParam)); } - static char *CharPtrFromSPtr(sptr_t lParam) { + static char *CharPtrFromSPtr(sptr_t lParam) noexcept { return static_cast<char *>(PtrFromSPtr(lParam)); } - static unsigned char *UCharPtrFromSPtr(sptr_t lParam) { + static unsigned char *UCharPtrFromSPtr(sptr_t lParam) noexcept { return static_cast<unsigned char *>(PtrFromSPtr(lParam)); } - static void *PtrFromUPtr(uptr_t wParam) { + static void *PtrFromUPtr(uptr_t wParam) noexcept { return reinterpret_cast<void *>(wParam); } - static const char *ConstCharPtrFromUPtr(uptr_t wParam) { + static const char *ConstCharPtrFromUPtr(uptr_t wParam) noexcept { return static_cast<const char *>(PtrFromUPtr(wParam)); } - static sptr_t StringResult(sptr_t lParam, const char *val); - static sptr_t BytesResult(sptr_t lParam, const unsigned char *val, size_t len); + static sptr_t StringResult(sptr_t lParam, const char *val) noexcept; + static sptr_t BytesResult(sptr_t lParam, const unsigned char *val, size_t len) noexcept; public: // Public so the COM thunks can access it. - bool IsUnicodeMode() const; + bool IsUnicodeMode() const noexcept; // Public so scintilla_send_message can use it. virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); // Public so scintilla_set_id can use it. diff --git a/src/MarginView.cxx b/src/MarginView.cxx index 8473974ba..42bf7982c 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -99,7 +99,7 @@ void DrawWrapMarker(Surface *surface, PRectangle rcPlace, y - 2 * dy); } -MarginView::MarginView() { +MarginView::MarginView() noexcept { wrapMarkerPaddingRight = 3; customDrawWrapMarker = nullptr; } diff --git a/src/MarginView.h b/src/MarginView.h index 1d5d46cac..4468afa1b 100644 --- a/src/MarginView.h +++ b/src/MarginView.h @@ -32,7 +32,7 @@ public: * existing platforms must implement as empty. */ DrawWrapMarkerFn customDrawWrapMarker; - MarginView(); + MarginView() noexcept; void DropGraphics(bool freeObjects); void AllocateGraphics(const ViewStyle &vsDraw); diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 3b3014ab5..99e564bc5 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -82,7 +82,7 @@ void LineLayout::Resize(int maxLineLength_) { } } -void LineLayout::Free() { +void LineLayout::Free() noexcept { chars.reset(); styles.reset(); positions.reset(); @@ -283,7 +283,7 @@ void LineLayoutCache::AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesI PLATFORM_ASSERT(cache.size() == lengthForLevel); } -void LineLayoutCache::Deallocate() { +void LineLayoutCache::Deallocate() noexcept { PLATFORM_ASSERT(useCount == 0); cache.clear(); } @@ -301,7 +301,7 @@ void LineLayoutCache::Invalidate(LineLayout::validLevel validity_) { } } -void LineLayoutCache::SetLevel(int level_) { +void LineLayoutCache::SetLevel(int level_) noexcept { allInvalidated = false; if ((level_ != -1) && (level != level_)) { level = level_; @@ -357,7 +357,7 @@ LineLayout *LineLayoutCache::Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, return ret; } -void LineLayoutCache::Dispose(LineLayout *ll) { +void LineLayoutCache::Dispose(LineLayout *ll) noexcept { allInvalidated = false; if (ll) { if (!ll->inCache) { @@ -380,7 +380,7 @@ static unsigned int KeyFromString(const char *charBytes, size_t len) { return k; } -SpecialRepresentations::SpecialRepresentations() { +SpecialRepresentations::SpecialRepresentations() noexcept { const short none = 0; std::fill(startByteHasReprs, std::end(startByteHasReprs), none); } @@ -556,11 +556,11 @@ TextSegment BreakFinder::Next() { } } -bool BreakFinder::More() const { +bool BreakFinder::More() const noexcept { return (subBreak >= 0) || (nextBreak < lineRange.end); } -PositionCacheEntry::PositionCacheEntry() : +PositionCacheEntry::PositionCacheEntry() noexcept : styleNumber(0), len(0), clock(0), positions(nullptr) { } @@ -593,7 +593,7 @@ PositionCacheEntry::~PositionCacheEntry() { Clear(); } -void PositionCacheEntry::Clear() { +void PositionCacheEntry::Clear() noexcept { positions.reset(); styleNumber = 0; len = 0; @@ -613,7 +613,7 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, } } -unsigned int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) { +unsigned int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) noexcept { unsigned int ret = s[0] << 7; for (unsigned int i=0; i<len_; i++) { ret *= 1000003; @@ -626,11 +626,11 @@ unsigned int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, return ret; } -bool PositionCacheEntry::NewerThan(const PositionCacheEntry &other) const { +bool PositionCacheEntry::NewerThan(const PositionCacheEntry &other) const noexcept { return clock > other.clock; } -void PositionCacheEntry::ResetClock() { +void PositionCacheEntry::ResetClock() noexcept { if (clock > 0) { clock = 1; } @@ -646,7 +646,7 @@ PositionCache::~PositionCache() { Clear(); } -void PositionCache::Clear() { +void PositionCache::Clear() noexcept { if (!allClear) { for (PositionCacheEntry &pce : pces) { pce.Clear(); diff --git a/src/PositionCache.h b/src/PositionCache.h index c3973eba9..6899ba99f 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -86,7 +86,7 @@ public: void operator=(LineLayout &&) = delete; virtual ~LineLayout(); void Resize(int maxLineLength_); - void Free(); + void Free() noexcept; void Invalidate(validLevel validity_); int LineStart(int line) const; enum class Scope { visibleOnly, includeEnd }; @@ -121,7 +121,7 @@ public: void operator=(const LineLayoutCache &) = delete; void operator=(LineLayoutCache &&) = delete; virtual ~LineLayoutCache(); - void Deallocate(); + void Deallocate() noexcept; enum { llcNone=SC_CACHE_NONE, llcCaret=SC_CACHE_CARET, @@ -129,11 +129,11 @@ public: llcDocument=SC_CACHE_DOCUMENT }; void Invalidate(LineLayout::validLevel validity_); - void SetLevel(int level_); - int GetLevel() const { return level; } + void SetLevel(int level_) noexcept; + int GetLevel() const noexcept { return level; } LineLayout *Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, int maxChars, int styleClock_, Sci::Line linesOnScreen, Sci::Line linesInDoc); - void Dispose(LineLayout *ll); + void Dispose(LineLayout *ll) noexcept; }; class PositionCacheEntry { @@ -142,7 +142,7 @@ class PositionCacheEntry { unsigned int clock:16; std::unique_ptr<XYPOSITION []> positions; public: - PositionCacheEntry(); + PositionCacheEntry() noexcept; // Copy constructor not currently used, but needed for being element in std::vector. PositionCacheEntry(const PositionCacheEntry &); // PositionCacheEntry objects should not be moved but MSVC 2015 requires this. @@ -151,11 +151,11 @@ public: void operator=(PositionCacheEntry &&) = delete; ~PositionCacheEntry(); void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, const XYPOSITION *positions_, unsigned int clock_); - void Clear(); + void Clear() noexcept; bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const; - static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len_); - bool NewerThan(const PositionCacheEntry &other) const; - void ResetClock(); + static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len_) noexcept; + bool NewerThan(const PositionCacheEntry &other) const noexcept; + void ResetClock() noexcept; }; class Representation { @@ -171,7 +171,7 @@ class SpecialRepresentations { MapRepresentation mapReprs; short startByteHasReprs[0x100]; public: - SpecialRepresentations(); + SpecialRepresentations() noexcept; void SetRepresentation(const char *charBytes, const char *value); void ClearRepresentation(const char *charBytes); const Representation *RepresentationFromCharacter(const char *charBytes, size_t len) const; @@ -220,7 +220,7 @@ public: void operator=(BreakFinder &&) = delete; ~BreakFinder(); TextSegment Next(); - bool More() const; + bool More() const noexcept; }; class PositionCache { @@ -235,9 +235,9 @@ public: void operator=(const PositionCache &) = delete; void operator=(PositionCache &&) = delete; ~PositionCache(); - void Clear(); + void Clear() noexcept; void SetSize(size_t size_); - size_t GetSize() const { return pces.size(); } + size_t GetSize() const noexcept { return pces.size(); } void MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber, const char *s, unsigned int len, XYPOSITION *positions, const Document *pdoc); }; |