Go to the source code of this file.
Functions | |
struct | SprintStructTemplate (T) |
typedef | SprintStructTemplate (char) SprintStruct |
class | SprintClassTemplate (T) |
typedef | SprintClassTemplate (char) Sprint |
Variables | |
module mango convert | Sprint |
import std | stdarg |
import mango convert | Type |
import mango convert mango convert | Format |
import mango convert mango convert mango convert | Unicode |
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for damages of any kind arising from the use of this software.
Permission is hereby granted to anyone to use this software for any purpose, including commercial applications, and to alter it and/or redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment within documentation of said product would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution of the source.
4. Derivative works are permitted, but they must carry this notice in full and credit the original source.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Definition in file Sprint.d.
|
Constructs sprintf-style output. This is a replacement for the vsprintf() family of functions, and writes it's output into a lookaside buffer. This is the stack-based version, used when heap allocation must be avoided ~ see Sprint for the class version
// output buffer char[100] tmp; SprintStruct sprint; sprint.ctor (tmp); // write text to the console Cout (sprint ("%d green bottles, sitting on a wall\n", 10)); State is maintained on the stack only, making this thread-safe. You may supply a workspace buffer as an optional initialization argument, which should typically also be allocated on the stack. Note that Sprint is templated, and can be instantiated for wide chars through a SprintStructTemplate!(dchar) or wchar. The wide versions differ in that both the output and the format-string are of the target type. Variadic string arguments are transcoded appropriately. Floating-point support is optional. The second ctor argument is for hooking up an appropriate formatter, such as Double.format or DGDouble.format. See Format.parse() for the list of format specifiers. Definition at line 86 of file Sprint.d. References buffer, Format, into(), SprintStructTemplate(), and type(). Referenced by SprintStructTemplate(). |
|
|
|
Constructs sprintf-style output. This is a replacement for the vsprintf() family of functions, and writes it's output into a lookaside buffer. This is the class-based version, used when convenience is a factor ~ see SprintStruct for the stack-based version
// create a Sprint instance Sprint sprint = new Sprint (100); // write text to the console Cout (sprint ("%d green bottles, sitting on a wall\n", 10)); This can be really handy when you wish to format text for a Logger. Please note that the class itself is stateful, and therefore a single instance is not shareable across multiple threads. Note that Sprint is templated, and can be instantiated for wide chars through a SprintStructTemplate!(dchar) or wchar. The wide versions differ in that both the output and the format-string are of the target type. Variadic string arguments are transcoded appropriately. Floating-point support is optional. The second ctor argument is for hooking up an appropriate formatter, such as Double.format or DGDouble.format. See Format.parse() for the list of format specifiers. Definition at line 182 of file Sprint.d. References buffer, Format, into(), Sprint, SprintClassTemplate(), and type(). Referenced by SprintClassTemplate(). |
|
|
|
|
|
|
|
|
|
|
|
|