A struct storing constructor parameters for MarkedYAMLException.
This commit is contained in:
parent
f5e027e9bb
commit
ba5d5bb3da
|
@ -59,7 +59,20 @@ struct Mark
|
|||
static assert(Mark.sizeof == 4, "Unexpected Mark size");
|
||||
|
||||
package:
|
||||
//Base class of YAML exceptions with marked positions of the problem.
|
||||
// A struct storing parameters to the MarkedYAMLException constructor.
|
||||
struct MarkedYAMLExceptionData
|
||||
{
|
||||
// Context of the error.
|
||||
string context;
|
||||
// Position of the context in a YAML buffer.
|
||||
Mark contextMark;
|
||||
// The error itself.
|
||||
string problem;
|
||||
// Position if the error.
|
||||
Mark problemMark;
|
||||
}
|
||||
|
||||
// Base class of YAML exceptions with marked positions of the problem.
|
||||
abstract class MarkedYAMLException : YAMLException
|
||||
{
|
||||
// Construct a MarkedYAMLException with specified context and problem.
|
||||
|
@ -78,6 +91,12 @@ abstract class MarkedYAMLException : YAMLException
|
|||
{
|
||||
super(problem ~ '\n' ~ problemMark.toString(), file, line);
|
||||
}
|
||||
|
||||
/// Construct a MarkedYAMLException from a struct storing constructor parameters.
|
||||
this(ref const(MarkedYAMLExceptionData) data) @safe pure nothrow
|
||||
{
|
||||
with(data) this(context, contextMark, problem, problemMark);
|
||||
}
|
||||
}
|
||||
|
||||
// Constructors of YAML exceptions are mostly the same, so we use a mixin.
|
||||
|
|
Loading…
Reference in a new issue