From cbac51bb9e56ebe73ac3768eb9610f036419f1c2 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sat, 24 Jan 2015 03:07:07 +0100 Subject: Improved SourceContext --- src/core/common/Location.hpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/core/common') diff --git a/src/core/common/Location.hpp b/src/core/common/Location.hpp index 808abbd..4b70619 100644 --- a/src/core/common/Location.hpp +++ b/src/core/common/Location.hpp @@ -371,22 +371,22 @@ struct SourceContext { /** * Start line, starting with one. */ - int startLine; + size_t startLine; /** * Start column, starting with one. */ - int startColumn; + size_t startColumn; /** * End line, starting with one. */ - int endLine; + size_t endLine; /** * End column, starting with one. */ - int endColumn; + size_t endColumn; /** * Set to the content of the current line. @@ -397,13 +397,13 @@ struct SourceContext { * Relative position (in characters) within that line. May point to * locations beyond the text content. */ - int relPos; + size_t relPos; /** * Relative length (in characters) within that line. May end beyond the * text given in the context. */ - int relLen; + size_t relLen; /** * Set to true if the beginning of the line has been truncated (because @@ -446,6 +446,11 @@ struct SourceContext { */ bool hasFile() const { return !filename.empty(); } + /** + * Returns true if some valid context text is set. + */ + bool hasText() const { return !text.empty(); } + /** * Returns true, if the start line number is valid, false otherwise. * @@ -479,7 +484,6 @@ using SourceContextCallback = * @return an empty, invalid SourceContext. */ SourceContext NullSourceContextCallback(const SourceLocation &location); - } #endif /* _OUSIA_LOCATION_HPP_ */ -- cgit v1.2.3