From 4f2f1c4d742d391eb541238317ede70959b6f58d Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 21 Apr 2018 11:22:39 +1000 Subject: Backport: Use noexcept in basic data structures where reasonable. Declare the standard member functions in more classes Backport of changeset 6725:2864bc1b748a. --- src/RunStyles.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/RunStyles.cxx') diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx index 6309edc44..7f385017a 100644 --- a/src/RunStyles.cxx +++ b/src/RunStyles.cxx @@ -29,7 +29,7 @@ using namespace Scintilla; // Find the first run at a position template -DISTANCE RunStyles::RunFromPosition(DISTANCE position) const { +DISTANCE RunStyles::RunFromPosition(DISTANCE position) const noexcept { DISTANCE run = starts->PartitionFromPosition(position); // Go to first element with this position while ((run > 0) && (position == starts->PositionFromPartition(run-1))) { @@ -88,17 +88,17 @@ RunStyles::~RunStyles() { } template -DISTANCE RunStyles::Length() const { +DISTANCE RunStyles::Length() const noexcept { return starts->PositionFromPartition(starts->Partitions()); } template -STYLE RunStyles::ValueAt(DISTANCE position) const { +STYLE RunStyles::ValueAt(DISTANCE position) const noexcept { return styles->ValueAt(starts->PartitionFromPosition(position)); } template -DISTANCE RunStyles::FindNextChange(DISTANCE position, DISTANCE end) const { +DISTANCE RunStyles::FindNextChange(DISTANCE position, DISTANCE end) const noexcept { const DISTANCE run = starts->PartitionFromPosition(position); if (run < starts->Partitions()) { const DISTANCE runChange = starts->PositionFromPartition(run); @@ -118,12 +118,12 @@ DISTANCE RunStyles::FindNextChange(DISTANCE position, DISTANCE } template -DISTANCE RunStyles::StartRun(DISTANCE position) const { +DISTANCE RunStyles::StartRun(DISTANCE position) const noexcept { return starts->PositionFromPartition(starts->PartitionFromPosition(position)); } template -DISTANCE RunStyles::EndRun(DISTANCE position) const { +DISTANCE RunStyles::EndRun(DISTANCE position) const noexcept { return starts->PositionFromPartition(starts->PartitionFromPosition(position) + 1); } @@ -243,12 +243,12 @@ void RunStyles::DeleteRange(DISTANCE position, DISTANCE deleteL } template -DISTANCE RunStyles::Runs() const { +DISTANCE RunStyles::Runs() const noexcept { return starts->Partitions(); } template -bool RunStyles::AllSame() const { +bool RunStyles::AllSame() const noexcept { for (int run = 1; run < starts->Partitions(); run++) { if (styles->ValueAt(run) != styles->ValueAt(run - 1)) return false; @@ -257,12 +257,12 @@ bool RunStyles::AllSame() const { } template -bool RunStyles::AllSameAs(STYLE value) const { +bool RunStyles::AllSameAs(STYLE value) const noexcept { return AllSame() && (styles->ValueAt(0) == value); } template -DISTANCE RunStyles::Find(STYLE value, DISTANCE start) const { +DISTANCE RunStyles::Find(STYLE value, DISTANCE start) const noexcept { if (start < Length()) { DISTANCE run = start ? RunFromPosition(start) : 0; if (styles->ValueAt(run) == value) -- cgit v1.2.3