Mercurial > projects > orange
view orange/util/io.d @ 11:27c5b6c5425f 0.0.1
Deserialization now works as well using D2. Compiles again with D1 and Tango. Cleaned up orange.util.io a bit.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 25 Jul 2010 13:25:55 +0200 |
parents | 99c52d46822a |
children |
line wrap: on
line source
/** * Copyright: Copyright (c) 2007-2008 Jacob Carlborg. All rights reserved. * Authors: Jacob Carlborg * Version: Initial created: 2007 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) * */ module orange.util.io; version (Tango) { import tango.io.Stdout; import tango.io.Console; import orange.util.string; } else import std.stdio; /** * Print to the standard output * * Params: * args = what to print */ void print (A...)(A args) { version (Tango) { const string fmt = "{}{}{}{}{}{}{}{}" "{}{}{}{}{}{}{}{}" "{}{}{}{}{}{}{}{}"; static assert (A.length <= fmt.length / 2, "mambo.io.print :: too many arguments"); Stdout.format(fmt[0 .. args.length * 2], args).flush; } else write(args); } /** * Print to the standard output, adds a new line * * Params: * args = what to print */ void println (A...)(A args) { version (Tango) { const string fmt = "{}{}{}{}{}{}{}{}" "{}{}{}{}{}{}{}{}" "{}{}{}{}{}{}{}{}"; static assert (A.length <= fmt.length / 2, "mambo.io.println :: too many arguments"); Stdout.formatln(fmt[0 .. args.length * 2], args); } else writeln(args); }