|
License: BSD style: see license.txt Version: Nov 2005: Initial release author: Kris $(DDOC_MODULE_MEMBERS // create a Sprint instance
auto sprint = new Sprint!(char);
// write formatted text to a logger
log.info (sprint ("{} green bottles, sitting on a wall\n", 10));
Sprint can be handy when you wish to format text for a Logger
or similar, since it avoids heap activity during conversion by
hosting a fixed size conversion buffer. This is important when
debugging since heap activity can be responsible for behavioral
changes. One would create a Sprint instance ahead of time, and
utilize it in conjunction with the logging package.
Please note that the class itself is stateful, and therefore a
single instance is not shareable across multiple threads. The
returned content is not .dup'd either, so do that yourself if
you require a persistent copy.
Note also that Sprint is templated, and can be instantiated for
wide chars through a Sprint!(dchar) or Sprint!(wchar). The wide
versions differ in that both the output and the format-string
are of the target type. Variadic text arguments are transcoded
appropriately.
See also: tango.text.convert.Layout
|
| Copyright (c) 2005 Kris Bell. All rights reserved :: page rendered by CandyDoc |