aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/graph_base.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform/graph_base.hpp')
-rw-r--r--include/cru/platform/graph_base.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/cru/platform/graph_base.hpp b/include/cru/platform/graph_base.hpp
index 0b997770..c880c7a2 100644
--- a/include/cru/platform/graph_base.hpp
+++ b/include/cru/platform/graph_base.hpp
@@ -229,6 +229,15 @@ struct TextRange final {
gsl::index GetEnd() const { return position + count; }
+ TextRange Normalize() const {
+ auto result = *this;
+ if (result.count < 0) {
+ result.position += result.count;
+ result.count = -result.count;
+ }
+ return result;
+ }
+
gsl::index position = 0;
gsl::index count = 0;
};