switch to a non-templated Dumper struct (#234)
switch to a non-templated Dumper struct merged-on-behalf-of: Basile-z <Basile-z@users.noreply.github.com>
This commit is contained in:
parent
8de1a45922
commit
e37c4daa7e
9 changed files with 68 additions and 80 deletions
|
@ -14,5 +14,5 @@ void main()
|
|||
writeln("The answer is ", root["Answer"].as!int);
|
||||
|
||||
//Dump the loaded document to output.yaml.
|
||||
dumper(File("output.yaml", "w").lockingTextWriter).dump(root);
|
||||
dumper().dump(File("output.yaml", "w").lockingTextWriter, root);
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ void main()
|
|||
{
|
||||
try
|
||||
{
|
||||
auto dumper = dumper(File("output.yaml", "w").lockingTextWriter);
|
||||
auto dumper = dumper();
|
||||
|
||||
auto document = Node([Color(255, 0, 0),
|
||||
Color(0, 255, 0),
|
||||
Color(0, 0, 255)]);
|
||||
|
||||
dumper.dump(document);
|
||||
dumper.dump(File("output.yaml", "w").lockingTextWriter, document);
|
||||
}
|
||||
catch(YAMLException e)
|
||||
{
|
||||
|
|
|
@ -129,7 +129,7 @@ void main(string[] args) //@safe
|
|||
{
|
||||
if(dump)
|
||||
{
|
||||
dumper(File(file ~ ".dump", "w").lockingTextWriter).dump(nodes);
|
||||
dumper().dump(File(file ~ ".dump", "w").lockingTextWriter, nodes);
|
||||
}
|
||||
}
|
||||
void runGetBenchmark() @safe
|
||||
|
|
|
@ -297,16 +297,16 @@ void main(string[] args)
|
|||
//Generate and dump the nodes.
|
||||
Node[] generated = generate(configFile);
|
||||
|
||||
auto dumper = dumper(File(args[1], "w").lockingTextWriter);
|
||||
auto dumper = dumper();
|
||||
auto encoding = config["encoding"];
|
||||
|
||||
dumper.indent = config["indent"].as!uint;
|
||||
dumper.textWidth = config["text-width"].as!uint;
|
||||
switch(encoding.as!string)
|
||||
{
|
||||
case "utf-16": dumper.dump!wchar(generated); break;
|
||||
case "utf-32": dumper.dump!dchar(generated); break;
|
||||
default: dumper.dump!char(generated); break;
|
||||
case "utf-16": dumper.dump!wchar(File(args[1], "w").lockingTextWriter, generated); break;
|
||||
case "utf-32": dumper.dump!dchar(File(args[1], "w").lockingTextWriter, generated); break;
|
||||
default: dumper.dump!char(File(args[1], "w").lockingTextWriter, generated); break;
|
||||
}
|
||||
}
|
||||
catch(YAMLException e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue