Index by title

Documentation

jive.stacktrace

Module provides stacktraces for exceptions (using the Tango TracedException hooks) and for signals (segfault, fpe, illegal instruction, abort).
Usage doesn’t require any effort besides importing the module in user code.

API Reference

jive.demangle

Module provides a phobos independent D symbol demangler.

API Reference

jive.layout

Module provides an alternative to tango.text.convert.Layout, which uses variadic templates to extract more type information than possible with standard variadic functions. It implements support for custom and nested formatting operations that work on a heapless basis. The format string syntax is similar but not identical to that of Tango.

API Reference
Format String Reference

jive.io

Module provides a simple set of functions for IO on Tango streams, including jive.layout based formatted output.
Reference

jive.formatters

Module provides generic custom formatters for jive.layout.
Reference

jive.base64

Module derives phobos std.base64, adding custom formatters for jive.layout.
Reference

jive.iterators

Module provides adaptors for modyfing the view on iterable objects.
Reference

jive.metastrings

Module derives phobos std.metastrings, but changes the format sequence to ’$’ in place of ’%s’.


Format String Reference

The syntax of a format specifier for a single argument is: ‘{‘ [ index ] [ ’,’ alignment ] [ ’:’ subformat ] ‘}’.

Just like Tango’s Layout, the actual type of the passed in argument defines permitted subformat strings for that argument.
The general syntax for a subformat specifier is: style parameter, where style is a single character and parameter is a positive number.

Unlike in Tango, escaping the ‘{‘ character is done using a slash; ‘}’ in nested format specifiers needs to be escaped as well.

Strings

Strings have no subformat, they are formatted as-is. UTF width conversion is performed as necessary.

Integers

Integer formatting follows that of Tango. The following styles are defined:

Style defaults to ‘d’ or ‘u’, depending on actual type.

Example:

sformat ("0x{:X10}", 0xdeadbeef); // returns "0x00DEADBEEF"

Floating point values

Floating point formatting follows that of Tango. The following styles are defined:

Style defaults to ‘f’.

Example:

sformat ("{:f2}", 1.234); // returns "1.23"

Pointers

The following styles are defined:

Style ‘p’ has no additional parameters.
Style ’*’ can be followed by a nested format specifier requesting formatting of the dereferenced value.
Style ‘z’ can be followed by a number limiting the maximum length of the zero-terminated array.
Style defaults to ‘p’.

Example:

char* lpstr = "foobar".ptr;
formatln ("{0} {0:z5}", lpstr); // outputs "0x######## fooba" 

uint x = 0xdeadbeef;
uint* px = &x;
formatln ("{:*{:x}}", px); // outputs "deadbeef" 

Linear arrays

Subformat syntax is: [ separator ] [ nested_format ].

Example:

sformat ("IP={0:.}, hex={0:{:X2}}", [192, 168, 1, 1]); // returns "IP=192.168.1.1, hex=C0A80101"

tango.time.Time.Time type

Formatting this type uses tango.text.locale.Convert.formatDateTime.

Composite types (structs, classes, interfaces, unions)

In general composite types have no defined formatting operation and requesting their formatting raises a compile-time error.
It is however possible to implement formatting for composite types by defining one or more of these methods inside:

These methods should perform output by calling sink and return the total number of characters written.

If a formatting operation was requested that used a character type for which opFormat was not overloaded, one of the other opFormat implementations will be used and UTF conversion performed automatically.


Jive

Jive is a utility library on top of Tango that gathers various stuff D programmers might find useful.

Contents

Download

Source is available from a mercurial repository at http://zygfryd.net/hg/jive/ or through the DSSS system.

Installation

Jive doesn’t require being compiled into a standalone library. Simply place it in your include directory.

Documentation

See Documentation