kameloso.prettyprint

Functions related to (formatting and) printing structs and classes to the local terminal, listing each member variable and their contents in an easy-to-visually-parse way.

Members

Functions

prettyformat
void prettyformat(Sink sink, Flag!"brightTerminal" bright, Things things)

Formats an aggregate object, with all its printable members with all their printable values. Overload that writes to a passed output range sink.

prettyformat
string prettyformat(Flag!"brightTerminal" bright, Things things)

Formats a struct object, with all its printable members with all their printable values. A string-returning overload that doesn't take an input range.

prettyformatAggregateMemberImpl
void prettyformatAggregateMemberImpl(Sink sink, FormatAggregateMemberArguments args)

Formats the description of an aggregate for insertion into a prettyformat listing.

prettyformatArrayMemberImpl
void prettyformatArrayMemberImpl(Sink sink, FormatArrayMemberArguments args)

Formats the description of an array for insertion into a prettyformat listing.

prettyformatAssociativeArrayMemberImpl
void prettyformatAssociativeArrayMemberImpl(Sink sink, FormatArrayMemberArguments args, string[string] content)

Formats the description of an associative array for insertion into a prettyformat listing.

prettyformatImpl
void prettyformatImpl(Sink sink, Flag!"brightTerminal" bright, Thing thing, uint typewidth, uint namewidth)

Formats an aggregate object, with all its printable members with all their printable values. This is an implementation template and should not be called directly; instead use prettyprint or prettyformat.

prettyformatOtherMemberImpl
void prettyformatOtherMemberImpl(Sink sink, FormatOtherMemberArguments args)

Formats the description of a non-string, non-array, non-aggregate value for insertion into a prettyformat listing.

prettyformatStringMemberImpl
void prettyformatStringMemberImpl(Sink sink, FormatStringMemberArguments args)

Formats the description of a string for insertion into a prettyformat listing. The full string is passed and the function will truncate it if it's too long.

prettyprint
void prettyprint(Things things)

Prettyprints out aggregate objects, with all their printable members with all their printable values.

Manifest constants

minimumNameWidth
enum minimumNameWidth;

The minimum width of the type column, in characters.

minimumTypeWidth
enum minimumTypeWidth;

The minimum width of the type column, in characters.

Structs

FormatAggregateMemberArguments
struct FormatAggregateMemberArguments

Argument aggregate for invocations of prettyformatAggregateMemberImpl.

FormatArrayMemberArguments
struct FormatArrayMemberArguments

Argument aggregate for invocations of prettyformatArrayMemberImpl.

FormatOtherMemberArguments
struct FormatOtherMemberArguments

Argument aggregate for invocations of prettyformatOtherMemberImpl.

FormatStringMemberArguments
struct FormatStringMemberArguments

Argument aggregate for invocations of prettyformatStringMemberImpl.

Templates

Widths
template Widths(Flag!"all" all, Things...)

Calculates the minimum padding needed to accommodate the strings of all the types and names of the members of the passed struct and/or classes, for formatting into neat columns.

Examples

prettyprint(client, bot, settings);

/* Output to screen:

-- IRCClient
   string nickname               "kameloso"(8)
   string user                   "kameloso"(8)
   string ident                  "NaN"(3)
   string realName               "kameloso IRC bot"(16)

-- IRCBot
   string account                "kameloso"(8)
 string[] admins                 ["zorael"](1)
 string[] homeChannels           ["#flerrp"](1)
 string[] guestChannels          ["#d"](1)

-- IRCServer
   string address                "irc.libera.chat"(16)
   ushort port                    6667
 */

Distance between types, member names and member values are deduced automatically based on how long they are (in terms of characters). If it doesn't line up, its a bug.

See Also

Meta