aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-04-28 09:37:22 +1000
committerNeil <nyamatongwe@gmail.com>2019-04-28 09:37:22 +1000
commit6a542f10f35a7f6182335250ac6fb25dbd230cac (patch)
tree8579d35a88cfbb6c8644fc938176c22058e85561
parent8be8298fd9fadccef7caa8cc4232f53a2f4b91fb (diff)
downloadscintilla-mirror-6a542f10f35a7f6182335250ac6fb25dbd230cac.tar.gz
Declare reading methods as noexcept where reasonable.
-rw-r--r--src/CellBuffer.cxx28
-rw-r--r--src/CellBuffer.h30
-rw-r--r--src/CharClassify.h4
-rw-r--r--src/Indicator.cxx2
-rw-r--r--src/Indicator.h8
-rw-r--r--src/KeyMap.cxx2
-rw-r--r--src/KeyMap.h4
7 files changed, 39 insertions, 39 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index 1abff92dc..4d8e711ee 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -456,7 +456,7 @@ void UndoHistory::SetSavePoint() {
savePoint = currentAction;
}
-bool UndoHistory::IsSavePoint() const {
+bool UndoHistory::IsSavePoint() const noexcept {
return savePoint == currentAction;
}
@@ -480,7 +480,7 @@ int UndoHistory::TentativeSteps() {
return -1;
}
-bool UndoHistory::CanUndo() const {
+bool UndoHistory::CanUndo() const noexcept {
return (currentAction > 0) && (maxAction > 0);
}
@@ -505,7 +505,7 @@ void UndoHistory::CompletedUndoStep() {
currentAction--;
}
-bool UndoHistory::CanRedo() const {
+bool UndoHistory::CanRedo() const noexcept {
return maxAction > currentAction;
}
@@ -595,7 +595,7 @@ const char *CellBuffer::RangePointer(Sci::Position position, Sci::Position range
return substance.RangePointer(position, rangeLength);
}
-Sci::Position CellBuffer::GapPosition() const {
+Sci::Position CellBuffer::GapPosition() const noexcept {
return substance.GapPosition();
}
@@ -691,7 +691,7 @@ void CellBuffer::SetLineEndTypes(int utf8LineEnds_) {
}
}
-bool CellBuffer::ContainsLineEnd(const char *s, Sci::Position length) const {
+bool CellBuffer::ContainsLineEnd(const char *s, Sci::Position length) const noexcept {
unsigned char chBeforePrev = 0;
unsigned char chPrev = 0;
for (Sci::Position i = 0; i < length; i++) {
@@ -756,7 +756,7 @@ Sci::Line CellBuffer::LineFromPositionIndex(Sci::Position pos, int lineCharacter
return plv->LineFromPositionIndex(pos, lineCharacterIndex);
}
-bool CellBuffer::IsReadOnly() const {
+bool CellBuffer::IsReadOnly() const noexcept {
return readOnly;
}
@@ -764,11 +764,11 @@ void CellBuffer::SetReadOnly(bool set) {
readOnly = set;
}
-bool CellBuffer::IsLarge() const {
+bool CellBuffer::IsLarge() const noexcept {
return largeDocument;
}
-bool CellBuffer::HasStyles() const {
+bool CellBuffer::HasStyles() const noexcept {
return hasStyles;
}
@@ -776,7 +776,7 @@ void CellBuffer::SetSavePoint() {
uh.SetSavePoint();
}
-bool CellBuffer::IsSavePoint() const {
+bool CellBuffer::IsSavePoint() const noexcept {
return uh.IsSavePoint();
}
@@ -792,7 +792,7 @@ int CellBuffer::TentativeSteps() {
return uh.TentativeSteps();
}
-bool CellBuffer::TentativeActive() const {
+bool CellBuffer::TentativeActive() const noexcept {
return uh.TentativeActive();
}
@@ -806,7 +806,7 @@ void CellBuffer::RemoveLine(Sci::Line line) {
plv->RemoveLine(line);
}
-bool CellBuffer::UTF8LineEndOverlaps(Sci::Position position) const {
+bool CellBuffer::UTF8LineEndOverlaps(Sci::Position position) const noexcept {
const unsigned char bytes[] = {
static_cast<unsigned char>(substance.ValueAt(position-2)),
static_cast<unsigned char>(substance.ValueAt(position-1)),
@@ -1134,7 +1134,7 @@ bool CellBuffer::SetUndoCollection(bool collectUndo) {
return collectingUndo;
}
-bool CellBuffer::IsCollectingUndo() const {
+bool CellBuffer::IsCollectingUndo() const noexcept {
return collectingUndo;
}
@@ -1155,7 +1155,7 @@ void CellBuffer::DeleteUndoHistory() {
uh.DeleteUndoHistory();
}
-bool CellBuffer::CanUndo() const {
+bool CellBuffer::CanUndo() const noexcept {
return uh.CanUndo();
}
@@ -1181,7 +1181,7 @@ void CellBuffer::PerformUndoStep() {
uh.CompletedUndoStep();
}
-bool CellBuffer::CanRedo() const {
+bool CellBuffer::CanRedo() const noexcept {
return uh.CanRedo();
}
diff --git a/src/CellBuffer.h b/src/CellBuffer.h
index 7d5682260..599f3b3f6 100644
--- a/src/CellBuffer.h
+++ b/src/CellBuffer.h
@@ -81,7 +81,7 @@ 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();
- bool IsSavePoint() const;
+ bool IsSavePoint() const noexcept;
// Tentative actions are used for input composition so that it can be undone cleanly
void TentativeStart();
@@ -91,11 +91,11 @@ public:
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
/// called that many times. Similarly for redo.
- bool CanUndo() const;
+ bool CanUndo() const noexcept;
int StartUndo();
const Action &GetUndoStep() const;
void CompletedUndoStep();
- bool CanRedo() const;
+ bool CanRedo() const noexcept;
int StartRedo();
const Action &GetRedoStep() const;
void CompletedRedoStep();
@@ -121,7 +121,7 @@ private:
std::unique_ptr<ILineVector> plv;
- bool UTF8LineEndOverlaps(Sci::Position position) const;
+ bool UTF8LineEndOverlaps(Sci::Position position) const noexcept;
bool UTF8IsCharacterBoundary(Sci::Position position) const;
void ResetLineEnds();
void RecalculateIndexLineStarts(Sci::Line lineFirst, Sci::Line lineLast);
@@ -148,14 +148,14 @@ public:
void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const;
const char *BufferPointer();
const char *RangePointer(Sci::Position position, Sci::Position rangeLength);
- Sci::Position GapPosition() const;
+ Sci::Position GapPosition() const noexcept;
Sci::Position Length() const noexcept;
void Allocate(Sci::Position newSize);
void SetUTF8Substance(bool utf8Substance_);
- int GetLineEndTypes() const { return utf8LineEnds; }
+ int GetLineEndTypes() const noexcept { return utf8LineEnds; }
void SetLineEndTypes(int utf8LineEnds_);
- bool ContainsLineEnd(const char *s, Sci::Position length) const;
+ bool ContainsLineEnd(const char *s, Sci::Position length) const noexcept;
void SetPerLine(PerLine *pl);
int LineCharacterIndex() const noexcept;
void AllocateLineCharacterIndex(int lineCharacterIndex);
@@ -176,23 +176,23 @@ public:
const char *DeleteChars(Sci::Position position, Sci::Position deleteLength, bool &startSequence);
- bool IsReadOnly() const;
+ bool IsReadOnly() const noexcept;
void SetReadOnly(bool set);
- bool IsLarge() const;
- bool HasStyles() const;
+ bool IsLarge() const noexcept;
+ bool HasStyles() const noexcept;
/// 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();
- bool IsSavePoint() const;
+ bool IsSavePoint() const noexcept;
void TentativeStart();
void TentativeCommit();
- bool TentativeActive() const;
+ bool TentativeActive() const noexcept;
int TentativeSteps();
bool SetUndoCollection(bool collectUndo);
- bool IsCollectingUndo() const;
+ bool IsCollectingUndo() const noexcept;
void BeginUndoAction();
void EndUndoAction();
void AddUndoAction(Sci::Position token, bool mayCoalesce);
@@ -200,11 +200,11 @@ public:
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
/// called that many times. Similarly for redo.
- bool CanUndo() const;
+ bool CanUndo() const noexcept;
int StartUndo();
const Action &GetUndoStep() const;
void PerformUndoStep();
- bool CanRedo() const;
+ bool CanRedo() const noexcept;
int StartRedo();
const Action &GetRedoStep() const;
void PerformRedoStep();
diff --git a/src/CharClassify.h b/src/CharClassify.h
index c1ca3c120..1381a1b34 100644
--- a/src/CharClassify.h
+++ b/src/CharClassify.h
@@ -18,8 +18,8 @@ public:
void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, cc newCharClass);
int GetCharsOfClass(cc characterClass, unsigned char *buffer) const;
- cc GetClass(unsigned char ch) const { return static_cast<cc>(charClass[ch]);}
- bool IsWord(unsigned char ch) const { return static_cast<cc>(charClass[ch]) == ccWord;}
+ cc GetClass(unsigned char ch) const noexcept { return static_cast<cc>(charClass[ch]);}
+ bool IsWord(unsigned char ch) const noexcept { return static_cast<cc>(charClass[ch]) == ccWord;}
private:
enum { maxChar=256 };
diff --git a/src/Indicator.cxx b/src/Indicator.cxx
index 8db760f2b..baa7c3bd0 100644
--- a/src/Indicator.cxx
+++ b/src/Indicator.cxx
@@ -23,7 +23,7 @@
using namespace Scintilla;
-static PRectangle PixelGridAlign(const PRectangle &rc) {
+static PRectangle PixelGridAlign(const PRectangle &rc) noexcept {
// Move left and right side to nearest pixel to avoid blurry visuals
return PRectangle(std::round(rc.left), std::floor(rc.top),
std::round(rc.right), std::floor(rc.bottom));
diff --git a/src/Indicator.h b/src/Indicator.h
index 9e5fda221..24319df99 100644
--- a/src/Indicator.h
+++ b/src/Indicator.h
@@ -17,7 +17,7 @@ struct StyleAndColour {
}
StyleAndColour(int style_, ColourDesired fore_ = ColourDesired(0, 0, 0)) noexcept : style(style_), fore(fore_) {
}
- bool operator==(const StyleAndColour &other) const {
+ bool operator==(const StyleAndColour &other) const noexcept {
return (style == other.style) && (fore == other.fore);
}
};
@@ -39,13 +39,13 @@ public:
sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(0) {
}
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const;
- bool IsDynamic() const {
+ bool IsDynamic() const noexcept {
return !(sacNormal == sacHover);
}
- bool OverridesTextFore() const {
+ bool OverridesTextFore() const noexcept {
return sacNormal.style == INDIC_TEXTFORE || sacHover.style == INDIC_TEXTFORE;
}
- int Flags() const {
+ int Flags() const noexcept {
return attributes;
}
void SetFlags(int attributes_);
diff --git a/src/KeyMap.cxx b/src/KeyMap.cxx
index 1f9a157fb..1e873dbfc 100644
--- a/src/KeyMap.cxx
+++ b/src/KeyMap.cxx
@@ -46,7 +46,7 @@ unsigned int KeyMap::Find(int key, int modifiers) const {
return (it == kmap.end()) ? 0 : it->second;
}
-const std::map<KeyModifiers, unsigned int> &KeyMap::GetKeyMap() const {
+const std::map<KeyModifiers, unsigned int> &KeyMap::GetKeyMap() const noexcept {
return kmap;
}
diff --git a/src/KeyMap.h b/src/KeyMap.h
index 539b5e99a..245b6daaa 100644
--- a/src/KeyMap.h
+++ b/src/KeyMap.h
@@ -27,7 +27,7 @@ public:
int modifiers;
KeyModifiers(int key_, int modifiers_) noexcept : key(key_), modifiers(modifiers_) {
}
- bool operator<(const KeyModifiers &other) const {
+ bool operator<(const KeyModifiers &other) const noexcept {
if (key == other.key)
return modifiers < other.modifiers;
else
@@ -56,7 +56,7 @@ public:
void Clear() noexcept;
void AssignCmdKey(int key, int modifiers, unsigned int msg);
unsigned int Find(int key, int modifiers) const; // 0 returned on failure
- const std::map<KeyModifiers, unsigned int> &GetKeyMap() const;
+ const std::map<KeyModifiers, unsigned int> &GetKeyMap() const noexcept;
};
}