From 9dd6903e1375b75911ee59ab511dc096cea98c1c Mon Sep 17 00:00:00 2001 From: Ferdinand Majerech Date: Tue, 22 Jul 2014 01:22:56 +0200 Subject: [PATCH] Better function attribs in Mark --- source/dyaml/exception.d | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/source/dyaml/exception.d b/source/dyaml/exception.d index 1c3d571..f3f3ee9 100644 --- a/source/dyaml/exception.d +++ b/source/dyaml/exception.d @@ -27,28 +27,31 @@ class YAMLException : Exception } } -///Position in a YAML stream, used for error messages. +/// Position in a YAML stream, used for error messages. struct Mark { private: - ///Line number. + /// Line number. ushort line_; - ///Column number. + /// Column number. ushort column_; public: - ///Construct a Mark with specified line and column in the file. - this(const uint line, const uint column) pure @safe nothrow + /// Construct a Mark with specified line and column in the file. + this(const uint line, const uint column) @safe pure nothrow @nogc { line_ = cast(ushort)min(ushort.max, line); column_ = cast(ushort)min(ushort.max, column); } - ///Get a string representation of the mark. - string toString() const @trusted pure + /// Get a string representation of the mark. + string toString() @safe pure nothrow const { - //Line/column numbers start at zero internally, make them start at 1. - string clamped(ushort v){return str(v + 1) ~ (v == ushort.max ? " or higher" : "");} + /// Line/column numbers start at zero internally, make them start at 1. + static string clamped(ushort v) @safe pure nothrow + { + return str(v + 1) ~ (v == ushort.max ? " or higher" : ""); + } return "line " ~ clamped(line_) ~ ",column " ~ clamped(column_); } }