aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-07-01 09:46:29 +1000
committerNeil <nyamatongwe@gmail.com>2019-07-01 09:46:29 +1000
commit4330ebdf53320a0b6e0d340e997ff9cff4f8c392 (patch)
treec655410f019b9e9d61c209202223ea2fb73ddc06
parentb2ca12842cc9df7578a54d0f4c3948e26444753f (diff)
downloadscintilla-mirror-4330ebdf53320a0b6e0d340e997ff9cff4f8c392.tar.gz
Use noexcept on Document where reasonable with no effect on external interface.
Adds LengthNoExcept method that copies Length but only for internal use.
-rw-r--r--src/Document.cxx96
-rw-r--r--src/Document.h67
2 files changed, 82 insertions, 81 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 226e9d158..cdfce3ad5 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -185,23 +185,23 @@ void Document::RemoveLine(Sci::Line line) {
}
}
-LineMarkers *Document::Markers() const {
+LineMarkers *Document::Markers() const noexcept {
return static_cast<LineMarkers *>(perLineData[ldMarkers].get());
}
-LineLevels *Document::Levels() const {
+LineLevels *Document::Levels() const noexcept {
return static_cast<LineLevels *>(perLineData[ldLevels].get());
}
-LineState *Document::States() const {
+LineState *Document::States() const noexcept {
return static_cast<LineState *>(perLineData[ldState].get());
}
-LineAnnotation *Document::Margins() const {
+LineAnnotation *Document::Margins() const noexcept {
return static_cast<LineAnnotation *>(perLineData[ldMargin].get());
}
-LineAnnotation *Document::Annotations() const {
+LineAnnotation *Document::Annotations() const noexcept {
return static_cast<LineAnnotation *>(perLineData[ldAnnotation].get());
}
@@ -307,7 +307,7 @@ void Document::TentativeUndo() {
}
}
-int Document::GetMark(Sci::Line line) const {
+int Document::GetMark(Sci::Line line) const noexcept {
return Markers()->MarkValue(line);
}
@@ -445,11 +445,11 @@ Sci::Position Document::VCHomePosition(Sci::Position position) const {
return startText;
}
-Sci::Position Document::IndexLineStart(Sci::Line line, int lineCharacterIndex) const {
+Sci::Position Document::IndexLineStart(Sci::Line line, int lineCharacterIndex) const noexcept {
return cb.IndexLineStart(line, lineCharacterIndex);
}
-Sci::Line Document::LineFromPositionIndex(Sci::Position pos, int lineCharacterIndex) const {
+Sci::Line Document::LineFromPositionIndex(Sci::Position pos, int lineCharacterIndex) const noexcept {
return cb.LineFromPositionIndex(pos, lineCharacterIndex);
}
@@ -592,20 +592,20 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, Sc
highlightDelimiter.firstChangeableLineAfter = firstChangeableLineAfter;
}
-Sci::Position Document::ClampPositionIntoDocument(Sci::Position pos) const {
- return std::clamp<Sci::Position>(pos, 0, Length());
+Sci::Position Document::ClampPositionIntoDocument(Sci::Position pos) const noexcept {
+ return std::clamp<Sci::Position>(pos, 0, LengthNoExcept());
}
-bool Document::IsCrLf(Sci::Position pos) const {
+bool Document::IsCrLf(Sci::Position pos) const noexcept {
if (pos < 0)
return false;
- if (pos >= (Length() - 1))
+ if (pos >= (LengthNoExcept() - 1))
return false;
return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n');
}
-int Document::LenChar(Sci::Position pos) {
- if (pos < 0 || pos >= Length()) {
+int Document::LenChar(Sci::Position pos) const noexcept {
+ if (pos < 0 || pos >= LengthNoExcept()) {
// Returning 1 instead of 0 to defend against hanging with a loop that goes (or starts) out of bounds.
return 1;
} else if (IsCrLf(pos)) {
@@ -631,7 +631,7 @@ int Document::LenChar(Sci::Position pos) {
return utf8status & UTF8MaskWidth;
}
} else {
- if (IsDBCSLeadByteNoExcept(leadByte) && ((pos + 1) < Length())) {
+ if (IsDBCSLeadByteNoExcept(leadByte) && ((pos + 1) < LengthNoExcept())) {
return 2;
} else {
return 1;
@@ -671,15 +671,15 @@ bool Document::InGoodUTF8(Sci::Position pos, Sci::Position &start, Sci::Position
// When lines are terminated with \r\n pairs which should be treated as one character.
// When displaying DBCS text such as Japanese.
// If moving, move the position in the indicated direction.
-Sci::Position Document::MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd) const {
+Sci::Position Document::MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd) const noexcept {
//Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir);
// If out of range, just return minimum/maximum value.
if (pos <= 0)
return 0;
- if (pos >= Length())
- return Length();
+ if (pos >= LengthNoExcept())
+ return LengthNoExcept();
- // PLATFORM_ASSERT(pos > 0 && pos < Length());
+ // PLATFORM_ASSERT(pos > 0 && pos < LengthNoExcept());
if (checkLineEnd && IsCrLf(pos - 1)) {
if (moveDir > 0)
return pos + 1;
@@ -706,7 +706,7 @@ Sci::Position Document::MovePositionOutsideChar(Sci::Position pos, Sci::Position
} else {
// Anchor DBCS calculations at start of line because start of line can
// not be a DBCS trail byte.
- const Sci::Position posStartLine = LineStart(LineFromPosition(pos));
+ const Sci::Position posStartLine = cb.LineStart(cb.LineFromPosition(pos));
if (pos == posStartLine)
return pos;
@@ -827,8 +827,8 @@ bool Document::NextCharacter(Sci::Position &pos, int moveDir) const noexcept {
}
}
-Document::CharacterExtracted Document::CharacterAfter(Sci::Position position) const {
- if (position >= Length()) {
+Document::CharacterExtracted Document::CharacterAfter(Sci::Position position) const noexcept {
+ if (position >= LengthNoExcept()) {
return CharacterExtracted(unicodeReplacementChar, 0);
}
const unsigned char leadByte = cb.UCharAt(position);
@@ -849,7 +849,7 @@ Document::CharacterExtracted Document::CharacterAfter(Sci::Position position) co
return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth);
}
} else {
- if (IsDBCSLeadByteNoExcept(leadByte) && ((position + 1) < Length())) {
+ if (IsDBCSLeadByteNoExcept(leadByte) && ((position + 1) < LengthNoExcept())) {
return CharacterExtracted::DBCS(leadByte, cb.UCharAt(position + 1));
} else {
return CharacterExtracted(leadByte, 1);
@@ -857,7 +857,7 @@ Document::CharacterExtracted Document::CharacterAfter(Sci::Position position) co
}
}
-Document::CharacterExtracted Document::CharacterBefore(Sci::Position position) const {
+Document::CharacterExtracted Document::CharacterBefore(Sci::Position position) const noexcept {
if (position <= 0) {
return CharacterExtracted(unicodeReplacementChar, 0);
}
@@ -918,7 +918,7 @@ Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart
return pos;
}
-Sci::Position Document::GetRelativePositionUTF16(Sci::Position positionStart, Sci::Position characterOffset) const {
+Sci::Position Document::GetRelativePositionUTF16(Sci::Position positionStart, Sci::Position characterOffset) const noexcept {
Sci::Position pos = positionStart;
if (dbcsCodePage) {
const int increment = (characterOffset > 0) ? 1 : -1;
@@ -933,7 +933,7 @@ Sci::Position Document::GetRelativePositionUTF16(Sci::Position positionStart, Sc
}
} else {
pos = positionStart + characterOffset;
- if ((pos < 0) || (pos > Length()))
+ if ((pos < 0) || (pos > LengthNoExcept()))
return INVALID_POSITION;
}
return pos;
@@ -1183,7 +1183,7 @@ bool Document::DeleteChars(Sci::Position pos, Sci::Position len) {
return false;
if (len <= 0)
return false;
- if ((pos + len) > Length())
+ if ((pos + len) > LengthNoExcept())
return false;
CheckReadOnly();
if (enteredModification != 0) {
@@ -1202,7 +1202,7 @@ bool Document::DeleteChars(Sci::Position pos, Sci::Position len) {
const char *text = cb.DeleteChars(pos, len, startSequence);
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
- if ((pos < Length()) || (pos == 0))
+ if ((pos < LengthNoExcept()) || (pos == 0))
ModifiedAt(pos);
else
ModifiedAt(pos-1);
@@ -1539,7 +1539,7 @@ Sci::Position Document::GetColumn(Sci::Position pos) {
return column;
}
-Sci::Position Document::CountCharacters(Sci::Position startPos, Sci::Position endPos) const {
+Sci::Position Document::CountCharacters(Sci::Position startPos, Sci::Position endPos) const noexcept {
startPos = MovePositionOutsideChar(startPos, 1, false);
endPos = MovePositionOutsideChar(endPos, -1, false);
Sci::Position count = 0;
@@ -1551,7 +1551,7 @@ Sci::Position Document::CountCharacters(Sci::Position startPos, Sci::Position en
return count;
}
-Sci::Position Document::CountUTF16(Sci::Position startPos, Sci::Position endPos) const {
+Sci::Position Document::CountUTF16(Sci::Position startPos, Sci::Position endPos) const noexcept {
startPos = MovePositionOutsideChar(startPos, 1, false);
endPos = MovePositionOutsideChar(endPos, -1, false);
Sci::Position count = 0;
@@ -1666,7 +1666,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
}
-int Document::Options() const {
+int Document::Options() const noexcept {
return (IsLarge() ? SC_DOCUMENTOPTION_TEXT_LARGE : 0) |
(cb.HasStyles() ? 0 : SC_DOCUMENTOPTION_STYLES_NONE);
}
@@ -1790,11 +1790,11 @@ Sci::Position Document::ExtendWordSelect(Sci::Position pos, int delta, bool only
pos -= ce.widthBytes;
}
} else {
- if (!onlyWordCharacters && pos < Length()) {
+ if (!onlyWordCharacters && pos < LengthNoExcept()) {
const CharacterExtracted ce = CharacterAfter(pos);
ccStart = WordCharacterClass(ce.character);
}
- while (pos < Length()) {
+ while (pos < LengthNoExcept()) {
const CharacterExtracted ce = CharacterAfter(pos);
if (WordCharacterClass(ce.character) != ccStart)
break;
@@ -1832,13 +1832,13 @@ Sci::Position Document::NextWordStart(Sci::Position pos, int delta) const {
} else {
CharacterExtracted ce = CharacterAfter(pos);
const CharClassify::cc ccStart = WordCharacterClass(ce.character);
- while (pos < Length()) {
+ while (pos < LengthNoExcept()) {
ce = CharacterAfter(pos);
if (WordCharacterClass(ce.character) != ccStart)
break;
pos += ce.widthBytes;
}
- while (pos < Length()) {
+ while (pos < LengthNoExcept()) {
ce = CharacterAfter(pos);
if (WordCharacterClass(ce.character) != CharClassify::ccSpace)
break;
@@ -1876,16 +1876,16 @@ Sci::Position Document::NextWordEnd(Sci::Position pos, int delta) const {
}
}
} else {
- while (pos < Length()) {
+ while (pos < LengthNoExcept()) {
const CharacterExtracted ce = CharacterAfter(pos);
if (WordCharacterClass(ce.character) != CharClassify::ccSpace)
break;
pos += ce.widthBytes;
}
- if (pos < Length()) {
+ if (pos < LengthNoExcept()) {
CharacterExtracted ce = CharacterAfter(pos);
const CharClassify::cc ccStart = WordCharacterClass(ce.character);
- while (pos < Length()) {
+ while (pos < LengthNoExcept()) {
ce = CharacterAfter(pos);
if (WordCharacterClass(ce.character) != ccStart)
break;
@@ -1901,7 +1901,7 @@ Sci::Position Document::NextWordEnd(Sci::Position pos, int delta) const {
* the previous character is of a different character class.
*/
bool Document::IsWordStartAt(Sci::Position pos) const {
- if (pos >= Length())
+ if (pos >= LengthNoExcept())
return false;
if (pos > 0) {
const CharacterExtracted cePos = CharacterAfter(pos);
@@ -1921,7 +1921,7 @@ bool Document::IsWordStartAt(Sci::Position pos) const {
bool Document::IsWordEndAt(Sci::Position pos) const {
if (pos <= 0)
return false;
- if (pos < Length()) {
+ if (pos < LengthNoExcept()) {
const CharacterExtracted cePos = CharacterAfter(pos);
const CharClassify::cc ccPos = WordCharacterClass(cePos.character);
const CharacterExtracted cePrev = CharacterBefore(pos);
@@ -1950,7 +1950,7 @@ bool Document::HasCaseFolder() const noexcept {
return pcf != nullptr;
}
-void Document::SetCaseFolder(CaseFolder *pcf_) {
+void Document::SetCaseFolder(CaseFolder *pcf_) noexcept {
pcf.reset(pcf_);
}
@@ -2145,7 +2145,7 @@ const char *Document::SubstituteByPosition(const char *text, Sci::Position *leng
return nullptr;
}
-int Document::LineCharacterIndex() const {
+int Document::LineCharacterIndex() const noexcept {
return cb.LineCharacterIndex();
}
@@ -2528,7 +2528,7 @@ Sci::Position Document::WordPartLeft(Sci::Position pos) const {
Sci::Position Document::WordPartRight(Sci::Position pos) const {
CharacterExtracted ceStart = CharacterAfter(pos);
- const Sci::Position length = Length();
+ const Sci::Position length = LengthNoExcept();
if (IsWordPartSeparator(ceStart.character)) {
while (pos < length && IsWordPartSeparator(CharacterAfter(pos).character))
pos += CharacterAfter(pos).widthBytes;
@@ -2570,14 +2570,14 @@ static constexpr bool IsLineEndChar(char c) noexcept {
return (c == '\n' || c == '\r');
}
-Sci::Position Document::ExtendStyleRange(Sci::Position pos, int delta, bool singleLine) {
+Sci::Position Document::ExtendStyleRange(Sci::Position pos, int delta, bool singleLine) noexcept {
const int sStart = cb.StyleAt(pos);
if (delta < 0) {
while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))))
pos--;
pos++;
} else {
- while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))))
+ while (pos < (LengthNoExcept()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))))
pos++;
}
return pos;
@@ -2607,7 +2607,7 @@ static char BraceOpposite(char ch) noexcept {
}
// TODO: should be able to extend styled region to find matching brace
-Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxReStyle*/) {
+Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxReStyle*/) noexcept {
const char chBrace = CharAt(position);
const char chSeek = BraceOpposite(chBrace);
if (chSeek == '\0')
@@ -2618,7 +2618,7 @@ Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxRe
direction = 1;
int depth = 1;
position = NextPosition(position, direction);
- while ((position >= 0) && (position < Length())) {
+ while ((position >= 0) && (position < LengthNoExcept())) {
const char chAtPos = CharAt(position);
const int styAtPos = StyleIndexAt(position);
if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
@@ -2674,7 +2674,7 @@ public:
Sci::Line lineRangeStart;
Sci::Line lineRangeEnd;
Sci::Line lineRangeBreak;
- RESearchRange(const Document *doc_, Sci::Position minPos, Sci::Position maxPos) : doc(doc_) {
+ RESearchRange(const Document *doc_, Sci::Position minPos, Sci::Position maxPos) noexcept : doc(doc_) {
increment = (minPos <= maxPos) ? 1 : -1;
// Range endpoints should not be inside DBCS characters or between a CR and LF,
diff --git a/src/Document.h b/src/Document.h
index d4a950ea5..ee0024f38 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -246,11 +246,11 @@ private:
// ldSize is not real data - it is for dimensions and loops
enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize };
std::unique_ptr<PerLine> perLineData[ldSize];
- LineMarkers *Markers() const;
- LineLevels *Levels() const;
- LineState *States() const;
- LineAnnotation *Margins() const;
- LineAnnotation *Annotations() const;
+ LineMarkers *Markers() const noexcept;
+ LineLevels *Levels() const noexcept;
+ LineState *States() const noexcept;
+ LineAnnotation *Margins() const noexcept;
+ LineAnnotation *Annotations() const noexcept;
bool matchesValid;
std::unique_ptr<RegexSearchBase> regex;
@@ -302,9 +302,9 @@ public:
int LineEndTypesSupported() const;
bool SetDBCSCodePage(int dbcsCodePage_);
- int GetLineEndTypesAllowed() const { return cb.GetLineEndTypes(); }
+ int GetLineEndTypesAllowed() const noexcept { return cb.GetLineEndTypes(); }
bool SetLineEndTypesAllowed(int lineEndBitSet_);
- int GetLineEndTypesActive() const { return cb.GetLineEndTypes(); }
+ int GetLineEndTypesActive() const noexcept { return cb.GetLineEndTypes(); }
int SCI_METHOD Version() const override {
return dvRelease4;
@@ -314,18 +314,18 @@ public:
Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const override;
Sci::Line SciLineFromPosition(Sci::Position pos) const noexcept; // Avoids casting LineFromPosition
- Sci::Position ClampPositionIntoDocument(Sci::Position pos) const;
- bool ContainsLineEnd(const char *s, Sci::Position length) const { return cb.ContainsLineEnd(s, length); }
- bool IsCrLf(Sci::Position pos) const;
- int LenChar(Sci::Position pos);
+ Sci::Position ClampPositionIntoDocument(Sci::Position pos) const noexcept;
+ bool ContainsLineEnd(const char *s, Sci::Position length) const noexcept { return cb.ContainsLineEnd(s, length); }
+ bool IsCrLf(Sci::Position pos) const noexcept;
+ int LenChar(Sci::Position pos) const noexcept;
bool InGoodUTF8(Sci::Position pos, Sci::Position &start, Sci::Position &end) const noexcept;
- Sci::Position MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd=true) const;
+ Sci::Position MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd=true) const noexcept;
Sci::Position NextPosition(Sci::Position pos, int moveDir) const noexcept;
bool NextCharacter(Sci::Position &pos, int moveDir) const noexcept; // Returns true if pos changed
- Document::CharacterExtracted CharacterAfter(Sci::Position position) const;
- Document::CharacterExtracted CharacterBefore(Sci::Position position) const;
+ Document::CharacterExtracted CharacterAfter(Sci::Position position) const noexcept;
+ Document::CharacterExtracted CharacterBefore(Sci::Position position) const noexcept;
Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const override;
- Sci::Position GetRelativePositionUTF16(Sci::Position positionStart, Sci::Position characterOffset) const;
+ Sci::Position GetRelativePositionUTF16(Sci::Position positionStart, Sci::Position characterOffset) const noexcept;
int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const override;
int SCI_METHOD CodePage() const override;
bool SCI_METHOD IsDBCSLeadByte(char ch) const override;
@@ -346,42 +346,42 @@ public:
void * SCI_METHOD ConvertToDocument() override;
Sci::Position Undo();
Sci::Position Redo();
- bool CanUndo() const { return cb.CanUndo(); }
- bool CanRedo() const { return cb.CanRedo(); }
+ bool CanUndo() const noexcept { return cb.CanUndo(); }
+ bool CanRedo() const noexcept { return cb.CanRedo(); }
void DeleteUndoHistory() { cb.DeleteUndoHistory(); }
bool SetUndoCollection(bool collectUndo) {
return cb.SetUndoCollection(collectUndo);
}
- bool IsCollectingUndo() const { return cb.IsCollectingUndo(); }
+ bool IsCollectingUndo() const noexcept { return cb.IsCollectingUndo(); }
void BeginUndoAction() { cb.BeginUndoAction(); }
void EndUndoAction() { cb.EndUndoAction(); }
void AddUndoAction(Sci::Position token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); }
void SetSavePoint();
- bool IsSavePoint() const { return cb.IsSavePoint(); }
+ bool IsSavePoint() const noexcept { return cb.IsSavePoint(); }
void TentativeStart() { cb.TentativeStart(); }
void TentativeCommit() { cb.TentativeCommit(); }
void TentativeUndo();
- bool TentativeActive() const { return cb.TentativeActive(); }
+ bool TentativeActive() const noexcept { return cb.TentativeActive(); }
const char * SCI_METHOD BufferPointer() override { return cb.BufferPointer(); }
const char *RangePointer(Sci::Position position, Sci::Position rangeLength) { return cb.RangePointer(position, rangeLength); }
- Sci::Position GapPosition() const { return cb.GapPosition(); }
+ Sci::Position GapPosition() const noexcept { return cb.GapPosition(); }
int SCI_METHOD GetLineIndentation(Sci_Position line) override;
Sci::Position SetLineIndentation(Sci::Line line, Sci::Position indent);
Sci::Position GetLineIndentPosition(Sci::Line line) const;
Sci::Position GetColumn(Sci::Position pos);
- Sci::Position CountCharacters(Sci::Position startPos, Sci::Position endPos) const;
- Sci::Position CountUTF16(Sci::Position startPos, Sci::Position endPos) const;
+ Sci::Position CountCharacters(Sci::Position startPos, Sci::Position endPos) const noexcept;
+ Sci::Position CountUTF16(Sci::Position startPos, Sci::Position endPos) const noexcept;
Sci::Position FindColumn(Sci::Line line, Sci::Position column);
void Indent(bool forwards, Sci::Line lineBottom, Sci::Line lineTop);
static std::string TransformLineEnds(const char *s, size_t len, int eolModeWanted);
void ConvertLineEnds(int eolModeSet);
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
- bool IsReadOnly() const { return cb.IsReadOnly(); }
- bool IsLarge() const { return cb.IsLarge(); }
- int Options() const;
+ bool IsReadOnly() const noexcept { return cb.IsReadOnly(); }
+ bool IsLarge() const noexcept { return cb.IsLarge(); }
+ int Options() const noexcept;
void DelChar(Sci::Position pos);
void DelCharBack(Sci::Position pos);
@@ -395,7 +395,7 @@ public:
void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const {
cb.GetStyleRange(buffer, position, lengthRetrieve);
}
- int GetMark(Sci::Line line) const;
+ int GetMark(Sci::Line line) const noexcept;
Sci::Line MarkerNext(Sci::Line lineStart, int mask) const;
int AddMark(Sci::Line line, int markerNum);
void AddMarkSet(Sci::Line line, int valueSet);
@@ -410,8 +410,8 @@ public:
bool IsLineEndPosition(Sci::Position position) const;
bool IsPositionInLineEnd(Sci::Position position) const;
Sci::Position VCHomePosition(Sci::Position position) const;
- Sci::Position IndexLineStart(Sci::Line line, int lineCharacterIndex) const;
- Sci::Line LineFromPositionIndex(Sci::Position pos, int lineCharacterIndex) const;
+ Sci::Position IndexLineStart(Sci::Line line, int lineCharacterIndex) const noexcept;
+ Sci::Line LineFromPositionIndex(Sci::Position pos, int lineCharacterIndex) const noexcept;
int SCI_METHOD SetLevel(Sci_Position line, int level) override;
int SCI_METHOD GetLevel(Sci_Position line) const override;
@@ -424,6 +424,7 @@ public:
Sci::Position NextWordStart(Sci::Position pos, int delta) const;
Sci::Position NextWordEnd(Sci::Position pos, int delta) const;
Sci_Position SCI_METHOD Length() const override { return cb.Length(); }
+ Sci::Position LengthNoExcept() const noexcept { return cb.Length(); }
void Allocate(Sci::Position newSize) { cb.Allocate(newSize); }
CharacterExtracted ExtractCharacter(Sci::Position position) const noexcept;
@@ -434,10 +435,10 @@ public:
bool MatchesWordOptions(bool word, bool wordStart, Sci::Position pos, Sci::Position length) const;
bool HasCaseFolder() const noexcept;
- void SetCaseFolder(CaseFolder *pcf_);
+ void SetCaseFolder(CaseFolder *pcf_) noexcept;
Sci::Position FindText(Sci::Position minPos, Sci::Position maxPos, const char *search, int flags, Sci::Position *length);
const char *SubstituteByPosition(const char *text, Sci::Position *length);
- int LineCharacterIndex() const;
+ int LineCharacterIndex() const noexcept;
void AllocateLineCharacterIndex(int lineCharacterIndex);
void ReleaseLineCharacterIndex(int lineCharacterIndex);
Sci::Line LinesTotal() const noexcept;
@@ -486,12 +487,12 @@ public:
bool IsWordPartSeparator(unsigned int ch) const;
Sci::Position WordPartLeft(Sci::Position pos) const;
Sci::Position WordPartRight(Sci::Position pos) const;
- Sci::Position ExtendStyleRange(Sci::Position pos, int delta, bool singleLine = false);
+ Sci::Position ExtendStyleRange(Sci::Position pos, int delta, bool singleLine) noexcept;
bool IsWhiteLine(Sci::Line line) const;
Sci::Position ParaUp(Sci::Position pos) const;
Sci::Position ParaDown(Sci::Position pos) const;
int IndentSize() const noexcept { return actualIndentInChars; }
- Sci::Position BraceMatch(Sci::Position position, Sci::Position maxReStyle);
+ Sci::Position BraceMatch(Sci::Position position, Sci::Position maxReStyle) noexcept;
private:
void NotifyModifyAttempt();