Simplified the Constructor API.

This commit is contained in:
Ferdinand Majerech 2011-11-17 23:53:24 +01:00
parent ab154480fb
commit fbc962623d
16 changed files with 217 additions and 297 deletions

View file

@ -337,17 +337,9 @@ struct TestStruct
}
///Constructor function for TestClass.
TestClass constructClass(Mark start, Mark end, ref Node node)
TestClass constructClass(ref Node node)
{
try
{
return new TestClass(node["x"].as!int, node["y"].as!int, node["z"].as!int);
}
catch(NodeException e)
{
throw new ConstructorException("Error constructing TestClass (missing data members?) "
~ e.msg, start, end);
}
return new TestClass(node["x"].as!int, node["y"].as!int, node["z"].as!int);
}
Node representClass(ref Node node, Representer representer)
@ -362,7 +354,7 @@ Node representClass(ref Node node, Representer representer)
}
///Constructor function for TestStruct.
TestStruct constructStruct(Mark start, Mark end, ref Node node)
TestStruct constructStruct(ref Node node)
{
return TestStruct(to!int(node.as!string));
}