aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Selection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Selection.h')
-rw-r--r--src/Selection.h98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/Selection.h b/src/Selection.h
index 82fc4aa48..d078c043e 100644
--- a/src/Selection.h
+++ b/src/Selection.h
@@ -19,37 +19,37 @@ public:
if (virtualSpace < 0)
virtualSpace = 0;
}
- void Reset() {
+ void Reset() noexcept {
position = 0;
virtualSpace = 0;
}
- void MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length);
- bool operator ==(const SelectionPosition &other) const {
+ void MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length) noexcept;
+ bool operator ==(const SelectionPosition &other) const noexcept {
return position == other.position && virtualSpace == other.virtualSpace;
}
- bool operator <(const SelectionPosition &other) const;
- bool operator >(const SelectionPosition &other) const;
- bool operator <=(const SelectionPosition &other) const;
- bool operator >=(const SelectionPosition &other) const;
- Sci::Position Position() const {
+ bool operator <(const SelectionPosition &other) const noexcept;
+ bool operator >(const SelectionPosition &other) const noexcept;
+ bool operator <=(const SelectionPosition &other) const noexcept;
+ bool operator >=(const SelectionPosition &other) const noexcept;
+ Sci::Position Position() const noexcept {
return position;
}
- void SetPosition(Sci::Position position_) {
+ void SetPosition(Sci::Position position_) noexcept {
position = position_;
virtualSpace = 0;
}
- Sci::Position VirtualSpace() const {
+ Sci::Position VirtualSpace() const noexcept {
return virtualSpace;
}
- void SetVirtualSpace(Sci::Position virtualSpace_) {
+ void SetVirtualSpace(Sci::Position virtualSpace_) noexcept {
PLATFORM_ASSERT(virtualSpace_ < 800000);
if (virtualSpace_ >= 0)
virtualSpace = virtualSpace_;
}
- void Add(Sci::Position increment) {
+ void Add(Sci::Position increment) noexcept {
position = position + increment;
}
- bool IsValid() const {
+ bool IsValid() const noexcept {
return position >= 0;
}
};
@@ -58,9 +58,9 @@ public:
struct SelectionSegment {
SelectionPosition start;
SelectionPosition end;
- SelectionSegment() : start(), end() {
+ SelectionSegment() noexcept : start(), end() {
}
- SelectionSegment(SelectionPosition a, SelectionPosition b) {
+ SelectionSegment(SelectionPosition a, SelectionPosition b) noexcept {
if (a < b) {
start = a;
end = b;
@@ -69,10 +69,10 @@ struct SelectionSegment {
end = a;
}
}
- bool Empty() const {
+ bool Empty() const noexcept {
return start == end;
}
- void Extend(SelectionPosition p) {
+ void Extend(SelectionPosition p) noexcept {
if (start > p)
start = p;
if (end < p)
@@ -94,40 +94,40 @@ struct SelectionRange {
}
SelectionRange(Sci::Position caret_, Sci::Position anchor_) noexcept : caret(caret_), anchor(anchor_) {
}
- bool Empty() const {
+ bool Empty() const noexcept {
return anchor == caret;
}
- Sci::Position Length() const;
+ Sci::Position Length() const noexcept;
// Sci::Position Width() const; // Like Length but takes virtual space into account
- bool operator ==(const SelectionRange &other) const {
+ bool operator ==(const SelectionRange &other) const noexcept {
return caret == other.caret && anchor == other.anchor;
}
- bool operator <(const SelectionRange &other) const {
+ bool operator <(const SelectionRange &other) const noexcept {
return caret < other.caret || ((caret == other.caret) && (anchor < other.anchor));
}
- void Reset() {
+ void Reset() noexcept {
anchor.Reset();
caret.Reset();
}
- void ClearVirtualSpace() {
+ void ClearVirtualSpace() noexcept {
anchor.SetVirtualSpace(0);
caret.SetVirtualSpace(0);
}
- void MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length);
- bool Contains(Sci::Position pos) const;
- bool Contains(SelectionPosition sp) const;
- bool ContainsCharacter(Sci::Position posCharacter) const;
- SelectionSegment Intersect(SelectionSegment check) const;
- SelectionPosition Start() const {
+ void MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length) noexcept;
+ bool Contains(Sci::Position pos) const noexcept;
+ bool Contains(SelectionPosition sp) const noexcept;
+ bool ContainsCharacter(Sci::Position posCharacter) const noexcept;
+ SelectionSegment Intersect(SelectionSegment check) const noexcept;
+ SelectionPosition Start() const noexcept {
return (anchor < caret) ? anchor : caret;
}
- SelectionPosition End() const {
+ SelectionPosition End() const noexcept {
return (anchor < caret) ? caret : anchor;
}
- void Swap();
- bool Trim(SelectionRange range);
+ void Swap() noexcept;
+ bool Trim(SelectionRange range) noexcept;
// If range is all virtual collapse to start of virtual space
- void MinimizeVirtualSpace();
+ void MinimizeVirtualSpace() noexcept;
};
class Selection {
@@ -141,31 +141,31 @@ public:
enum selTypes { noSel, selStream, selRectangle, selLines, selThin };
selTypes selType;
- Selection() noexcept;
+ Selection();
~Selection();
- bool IsRectangular() const;
+ bool IsRectangular() const noexcept;
Sci::Position MainCaret() const;
Sci::Position MainAnchor() const;
- SelectionRange &Rectangular();
+ SelectionRange &Rectangular() noexcept;
SelectionSegment Limits() const;
// This is for when you want to move the caret in response to a
// user direction command - for rectangular selections, use the range
// that covers all selected text otherwise return the main selection.
SelectionSegment LimitsForRectangularElseMain() const;
- size_t Count() const;
- size_t Main() const;
- void SetMain(size_t r);
+ size_t Count() const noexcept;
+ size_t Main() const noexcept;
+ void SetMain(size_t r) noexcept;
SelectionRange &Range(size_t r);
const SelectionRange &Range(size_t r) const;
SelectionRange &RangeMain();
const SelectionRange &RangeMain() const;
SelectionPosition Start() const;
- bool MoveExtends() const;
- void SetMoveExtends(bool moveExtends_);
- bool Empty() const;
- SelectionPosition Last() const;
- Sci::Position Length() const;
- void MovePositions(bool insertion, Sci::Position startChange, Sci::Position length);
+ bool MoveExtends() const noexcept;
+ void SetMoveExtends(bool moveExtends_) noexcept;
+ bool Empty() const noexcept;
+ SelectionPosition Last() const noexcept;
+ Sci::Position Length() const noexcept;
+ void MovePositions(bool insertion, Sci::Position startChange, Sci::Position length) noexcept;
void TrimSelection(SelectionRange range);
void TrimOtherSelections(size_t r, SelectionRange range);
void SetSelection(SelectionRange range);
@@ -174,14 +174,14 @@ public:
void DropSelection(size_t r);
void DropAdditionalRanges();
void TentativeSelection(SelectionRange range);
- void CommitTentative();
+ void CommitTentative() noexcept;
int CharacterInSelection(Sci::Position posCharacter) const;
int InSelectionForEOL(Sci::Position pos) const;
- Sci::Position VirtualSpaceFor(Sci::Position pos) const;
+ Sci::Position VirtualSpaceFor(Sci::Position pos) const noexcept;
void Clear();
void RemoveDuplicates();
- void RotateMain();
- bool Tentative() const { return tentativeMain; }
+ void RotateMain() noexcept;
+ bool Tentative() const noexcept { return tentativeMain; }
std::vector<SelectionRange> RangesCopy() const {
return ranges;
}