putExtended

A helper function which accepts a wide variety of parameters to pass to CodeBuilder.put.

More...

Parameters

builder CodeBuilder

The CodeBuilder to use.

param T

The parameter to put.

Return Value

builder

Detailed Description

Supported Types

InputRanges of characters (dstring, for example) - Written in as-is, with no modification.

CodeFunc - The CodeFunc is called with builder as it's parameter.

Variable - The name of the variable is written.

Any built-in D type - The result of passing the parameter to std.conv.to!string is written.

Examples

auto builder = new CodeBuilder();

builder.putExtended("Hello"d)                           // strings
       .putExtended((CodeBuilder b) => b.put("World!")) // CodeFuncs
       .putExtended(Variable("int", "myVar", null))     // Variables (only their names are written)
       .putExtended(true);                              // Built-in D types (bools, ints, floats, etc.)

builder.data.should.equal("Hello\nWorld!\nmyVar\ntrue\n"d);

Meta