diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CaseFolder.cxx | 4 | ||||
-rw-r--r-- | src/CaseFolder.h | 4 | ||||
-rw-r--r-- | src/CellBuffer.cxx | 42 | ||||
-rw-r--r-- | src/CellBuffer.h | 22 |
4 files changed, 38 insertions, 34 deletions
diff --git a/src/CaseFolder.cxx b/src/CaseFolder.cxx index 7db4bb679..bce593a98 100644 --- a/src/CaseFolder.cxx +++ b/src/CaseFolder.cxx @@ -17,7 +17,7 @@ using namespace Scintilla; CaseFolder::~CaseFolder() { } -CaseFolderTable::CaseFolderTable() : mapping{} { +CaseFolderTable::CaseFolderTable() noexcept : mapping{} { for (size_t iChar=0; iChar<sizeof(mapping); iChar++) { mapping[iChar] = static_cast<char>(iChar); } @@ -37,7 +37,7 @@ size_t CaseFolderTable::Fold(char *folded, size_t sizeFolded, const char *mixed, } } -void CaseFolderTable::SetTranslation(char ch, char chTranslation) { +void CaseFolderTable::SetTranslation(char ch, char chTranslation) noexcept { mapping[static_cast<unsigned char>(ch)] = chTranslation; } diff --git a/src/CaseFolder.h b/src/CaseFolder.h index eb852a491..966069bc4 100644 --- a/src/CaseFolder.h +++ b/src/CaseFolder.h @@ -20,10 +20,10 @@ class CaseFolderTable : public CaseFolder { protected: char mapping[256]; public: - CaseFolderTable(); + CaseFolderTable() noexcept; ~CaseFolderTable() override; size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; - void SetTranslation(char ch, char chTranslation); + void SetTranslation(char ch, char chTranslation) noexcept; void StandardASCII() noexcept; }; diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 80dc02d64..74fb74816 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -62,16 +62,16 @@ struct CountWidths { class ILineVector { public: virtual void Init() = 0; - virtual void SetPerLine(PerLine *pl) = 0; - virtual void InsertText(Sci::Line line, Sci::Position delta) = 0; + virtual void SetPerLine(PerLine *pl) noexcept = 0; + virtual void InsertText(Sci::Line line, Sci::Position delta) noexcept = 0; virtual void InsertLine(Sci::Line line, Sci::Position position, bool lineStart) = 0; virtual void SetLineStart(Sci::Line line, Sci::Position position) noexcept = 0; virtual void RemoveLine(Sci::Line line) = 0; virtual Sci::Line Lines() const noexcept = 0; virtual Sci::Line LineFromPosition(Sci::Position pos) const noexcept = 0; virtual Sci::Position LineStart(Sci::Line line) const noexcept = 0; - virtual void InsertCharacters(Sci::Line line, CountWidths delta) = 0; - virtual void SetLineCharactersWidth(Sci::Line line, CountWidths width) = 0; + virtual void InsertCharacters(Sci::Line line, CountWidths delta) noexcept = 0; + virtual void SetLineCharactersWidth(Sci::Line line, CountWidths width) noexcept = 0; virtual int LineCharacterIndex() const noexcept = 0; virtual bool AllocateLineCharacterIndex(int lineCharacterIndex, Sci::Line lines) = 0; virtual bool ReleaseLineCharacterIndex(int lineCharacterIndex) = 0; @@ -124,7 +124,7 @@ public: return starts.PositionFromPartition(static_cast<POS>(line) + 1) - starts.PositionFromPartition(static_cast<POS>(line)); } - void SetLineWidth(Sci::Line line, Sci::Position width) { + void SetLineWidth(Sci::Line line, Sci::Position width) noexcept { const Sci::Position widthCurrent = LineWidth(line); starts.InsertText(static_cast<POS>(line), static_cast<POS>(width - widthCurrent)); } @@ -154,10 +154,10 @@ public: startsUTF32.starts.DeleteAll(); startsUTF16.starts.DeleteAll(); } - void SetPerLine(PerLine *pl) override { + void SetPerLine(PerLine *pl) noexcept override { perLine = pl; } - void InsertText(Sci::Line line, Sci::Position delta) override { + void InsertText(Sci::Line line, Sci::Position delta) noexcept override { starts.InsertText(static_cast<POS>(line), static_cast<POS>(delta)); } void InsertLine(Sci::Line line, Sci::Position position, bool lineStart) override { @@ -201,7 +201,7 @@ public: Sci::Position LineStart(Sci::Line line) const noexcept override { return starts.PositionFromPartition(static_cast<POS>(line)); } - void InsertCharacters(Sci::Line line, CountWidths delta) override { + void InsertCharacters(Sci::Line line, CountWidths delta) noexcept override { if (startsUTF32.Active()) { startsUTF32.starts.InsertText(static_cast<POS>(line), static_cast<POS>(delta.WidthUTF32())); } @@ -209,7 +209,7 @@ public: startsUTF16.starts.InsertText(static_cast<POS>(line), static_cast<POS>(delta.WidthUTF16())); } } - void SetLineCharactersWidth(Sci::Line line, CountWidths width) override { + void SetLineCharactersWidth(Sci::Line line, CountWidths width) noexcept override { if (startsUTF32.Active()) { assert(startsUTF32.starts.Partitions() == starts.Partitions()); startsUTF32.SetLineWidth(line, width.WidthUTF32()); @@ -268,7 +268,7 @@ public: } }; -Action::Action() { +Action::Action() noexcept { at = startAction; position = 0; lenData = 0; @@ -290,7 +290,7 @@ void Action::Create(actionType at_, Sci::Position position_, const char *data_, mayCoalesce = mayCoalesce_; } -void Action::Clear() { +void Action::Clear() noexcept { data = nullptr; lenData = 0; } @@ -450,7 +450,7 @@ void UndoHistory::DeleteUndoHistory() { tentativePoint = -1; } -void UndoHistory::SetSavePoint() { +void UndoHistory::SetSavePoint() noexcept { savePoint = currentAction; } @@ -468,7 +468,11 @@ void UndoHistory::TentativeCommit() { maxAction = currentAction; } -int UndoHistory::TentativeSteps() { +bool UndoHistory::TentativeActive() const noexcept { + return tentativePoint >= 0; +} + +int UndoHistory::TentativeSteps() noexcept { // Drop any trailing startAction if (actions[currentAction].at == startAction && currentAction > 0) currentAction--; @@ -593,7 +597,7 @@ const char *CellBuffer::BufferPointer() { return substance.BufferPointer(); } -const char *CellBuffer::RangePointer(Sci::Position position, Sci::Position rangeLength) { +const char *CellBuffer::RangePointer(Sci::Position position, Sci::Position rangeLength) noexcept { return substance.RangePointer(position, rangeLength); } @@ -617,7 +621,7 @@ const char *CellBuffer::InsertString(Sci::Position position, const char *s, Sci: return data; } -bool CellBuffer::SetStyleAt(Sci::Position position, char styleValue) { +bool CellBuffer::SetStyleAt(Sci::Position position, char styleValue) noexcept { if (!hasStyles) { return false; } @@ -677,7 +681,7 @@ void CellBuffer::Allocate(Sci::Position newSize) { } } -void CellBuffer::SetUTF8Substance(bool utf8Substance_) { +void CellBuffer::SetUTF8Substance(bool utf8Substance_) noexcept { utf8Substance = utf8Substance_; } @@ -709,7 +713,7 @@ bool CellBuffer::ContainsLineEnd(const char *s, Sci::Position length) const noex return false; } -void CellBuffer::SetPerLine(PerLine *pl) { +void CellBuffer::SetPerLine(PerLine *pl) noexcept { plv->SetPerLine(pl); } @@ -759,7 +763,7 @@ bool CellBuffer::IsReadOnly() const noexcept { return readOnly; } -void CellBuffer::SetReadOnly(bool set) { +void CellBuffer::SetReadOnly(bool set) noexcept { readOnly = set; } @@ -787,7 +791,7 @@ void CellBuffer::TentativeCommit() { uh.TentativeCommit(); } -int CellBuffer::TentativeSteps() { +int CellBuffer::TentativeSteps() noexcept { return uh.TentativeSteps(); } diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 599f3b3f6..5138fd0aa 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -37,7 +37,7 @@ public: Sci::Position lenData; bool mayCoalesce; - Action(); + Action() noexcept; // Deleted so Action objects can not be copied. Action(const Action &other) = delete; Action &operator=(const Action &other) = delete; @@ -46,7 +46,7 @@ public: Action(Action &&other) noexcept = default; ~Action(); void Create(actionType at_, Sci::Position position_=0, const char *data_=nullptr, Sci::Position lenData_=0, bool mayCoalesce_=true); - void Clear(); + void Clear() noexcept; }; /** @@ -80,14 +80,14 @@ public: /// The save point is a marker in the undo stack where the container has stated that /// the buffer was saved. Undo and redo can move over the save point. - void SetSavePoint(); + void SetSavePoint() noexcept; bool IsSavePoint() const noexcept; // Tentative actions are used for input composition so that it can be undone cleanly void TentativeStart(); void TentativeCommit(); - bool TentativeActive() const noexcept { return tentativePoint >= 0; } - int TentativeSteps(); + bool TentativeActive() const noexcept; + int TentativeSteps() noexcept; /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is /// called that many times. Similarly for redo. @@ -147,16 +147,16 @@ public: char StyleAt(Sci::Position position) const noexcept; void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const; const char *BufferPointer(); - const char *RangePointer(Sci::Position position, Sci::Position rangeLength); + const char *RangePointer(Sci::Position position, Sci::Position rangeLength) noexcept; Sci::Position GapPosition() const noexcept; Sci::Position Length() const noexcept; void Allocate(Sci::Position newSize); - void SetUTF8Substance(bool utf8Substance_); + void SetUTF8Substance(bool utf8Substance_) noexcept; int GetLineEndTypes() const noexcept { return utf8LineEnds; } void SetLineEndTypes(int utf8LineEnds_); bool ContainsLineEnd(const char *s, Sci::Position length) const noexcept; - void SetPerLine(PerLine *pl); + void SetPerLine(PerLine *pl) noexcept; int LineCharacterIndex() const noexcept; void AllocateLineCharacterIndex(int lineCharacterIndex); void ReleaseLineCharacterIndex(int lineCharacterIndex); @@ -171,13 +171,13 @@ public: /// Setting styles for positions outside the range of the buffer is safe and has no effect. /// @return true if the style of a character is changed. - bool SetStyleAt(Sci::Position position, char styleValue); + bool SetStyleAt(Sci::Position position, char styleValue) noexcept; bool SetStyleFor(Sci::Position position, Sci::Position lengthStyle, char styleValue); const char *DeleteChars(Sci::Position position, Sci::Position deleteLength, bool &startSequence); bool IsReadOnly() const noexcept; - void SetReadOnly(bool set); + void SetReadOnly(bool set) noexcept; bool IsLarge() const noexcept; bool HasStyles() const noexcept; @@ -189,7 +189,7 @@ public: void TentativeStart(); void TentativeCommit(); bool TentativeActive() const noexcept; - int TentativeSteps(); + int TentativeSteps() noexcept; bool SetUndoCollection(bool collectUndo); bool IsCollectingUndo() const noexcept; |