Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

TextFormat Class Reference

List of all members.

Public Types

typedef format opCall

Public Member Functions

 this (int limit, char[] workspace=null, Format.DblFormat df=null)
char[] format (char[] fmt,...)
char[] content ()

Private Attributes

int count
char[] output
Format Sprintf sprintf

Detailed Description

Constructs printf-style output. This is an adapter for "old" printf formatting, and writes it's output into a lookaside buffer. Content from the buffer can easily be passed to an IWriter instance.

        // create a TextFormat instance
        TextFormat format = new TextFormat (256);

        // write text to Stdout
        Stdout (format ("%d green bottles, sitting on a wall\n", 10));

        // or access the content, post formatting ...
        char[] text = format.content;

This can be really handy when you wish to format text in conjunction with a Logger. Please note that the class is stateful, and therefore is not shareable across multiple threads.

Definition at line 66 of file TextFormat.d.


Member Typedef Documentation

typedef format opCall
 

Definition at line 68 of file TextFormat.d.


Member Function Documentation

this int  limit,
char[]  workspace = null,
Format.DblFormat  df = null
[inline]
 

Set the maximum buffer length

Definition at line 80 of file TextFormat.d.

References output, and sprintf.

char [] format char[]  fmt,
  ...
[inline]
 

format a set of arguments

Definition at line 92 of file TextFormat.d.

References content(), count, and sprintf.

char [] content  )  [inline]
 

Address formatted output as a char[]

Definition at line 104 of file TextFormat.d.

References count, and output.

Referenced by format().


Member Data Documentation

int count [private]
 

Definition at line 70 of file TextFormat.d.

Referenced by content(), and format().

char [] output [private]
 

Definition at line 71 of file TextFormat.d.

Referenced by content(), and this().

Format Sprintf sprintf [private]
 

Definition at line 72 of file TextFormat.d.

Referenced by format(), and this().


The documentation for this class was generated from the following file:
Generated on Fri Nov 11 18:44:44 2005 for Mango by  doxygen 1.4.0