diff options
author | Neil <nyamatongwe@gmail.com> | 2018-04-21 11:22:39 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-04-21 11:22:39 +1000 |
commit | b9bf45fea55a56203f16a1eea4de7f46d8bbf964 (patch) | |
tree | 09cbc057fdb43e61ba703617e19c8b3b341670fb /src/RunStyles.cxx | |
parent | 8634c0958c532e7d219e649353e1f1a74d52da1b (diff) | |
download | scintilla-mirror-b9bf45fea55a56203f16a1eea4de7f46d8bbf964.tar.gz |
Use noexcept in basic data structures where reasonable.
Declare the standard member functions in more classes
Diffstat (limited to 'src/RunStyles.cxx')
-rw-r--r-- | src/RunStyles.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx index 23392436b..95fe10ecd 100644 --- a/src/RunStyles.cxx +++ b/src/RunStyles.cxx @@ -29,7 +29,7 @@ using namespace Scintilla; // Find the first run at a position template <typename DISTANCE, typename STYLE> -DISTANCE RunStyles<DISTANCE, STYLE>::RunFromPosition(DISTANCE position) const { +DISTANCE RunStyles<DISTANCE, STYLE>::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<DISTANCE, STYLE>::~RunStyles() { } template <typename DISTANCE, typename STYLE> -DISTANCE RunStyles<DISTANCE, STYLE>::Length() const { +DISTANCE RunStyles<DISTANCE, STYLE>::Length() const noexcept { return starts->PositionFromPartition(starts->Partitions()); } template <typename DISTANCE, typename STYLE> -STYLE RunStyles<DISTANCE, STYLE>::ValueAt(DISTANCE position) const { +STYLE RunStyles<DISTANCE, STYLE>::ValueAt(DISTANCE position) const noexcept { return styles->ValueAt(starts->PartitionFromPosition(position)); } template <typename DISTANCE, typename STYLE> -DISTANCE RunStyles<DISTANCE, STYLE>::FindNextChange(DISTANCE position, DISTANCE end) const { +DISTANCE RunStyles<DISTANCE, STYLE>::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<DISTANCE, STYLE>::FindNextChange(DISTANCE position, DISTANCE } template <typename DISTANCE, typename STYLE> -DISTANCE RunStyles<DISTANCE, STYLE>::StartRun(DISTANCE position) const { +DISTANCE RunStyles<DISTANCE, STYLE>::StartRun(DISTANCE position) const noexcept { return starts->PositionFromPartition(starts->PartitionFromPosition(position)); } template <typename DISTANCE, typename STYLE> -DISTANCE RunStyles<DISTANCE, STYLE>::EndRun(DISTANCE position) const { +DISTANCE RunStyles<DISTANCE, STYLE>::EndRun(DISTANCE position) const noexcept { return starts->PositionFromPartition(starts->PartitionFromPosition(position) + 1); } @@ -243,12 +243,12 @@ void RunStyles<DISTANCE, STYLE>::DeleteRange(DISTANCE position, DISTANCE deleteL } template <typename DISTANCE, typename STYLE> -DISTANCE RunStyles<DISTANCE, STYLE>::Runs() const { +DISTANCE RunStyles<DISTANCE, STYLE>::Runs() const noexcept { return starts->Partitions(); } template <typename DISTANCE, typename STYLE> -bool RunStyles<DISTANCE, STYLE>::AllSame() const { +bool RunStyles<DISTANCE, STYLE>::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<DISTANCE, STYLE>::AllSame() const { } template <typename DISTANCE, typename STYLE> -bool RunStyles<DISTANCE, STYLE>::AllSameAs(STYLE value) const { +bool RunStyles<DISTANCE, STYLE>::AllSameAs(STYLE value) const noexcept { return AllSame() && (styles->ValueAt(0) == value); } template <typename DISTANCE, typename STYLE> -DISTANCE RunStyles<DISTANCE, STYLE>::Find(STYLE value, DISTANCE start) const { +DISTANCE RunStyles<DISTANCE, STYLE>::Find(STYLE value, DISTANCE start) const noexcept { if (start < Length()) { DISTANCE run = start ? RunFromPosition(start) : 0; if (styles->ValueAt(run) == value) |