View source code Display the source code in std/base64.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.base64.base64_impl.decoder - multiple declarations

Function Base64Impl.decoder

Iterates through an InputRange at a time by using Decoder.

Default Decoder decodes chunk data.

Prototype

Base64Impl.Decoder!Range decoder(Range)(
  Range range
)
if (isInputRange!Range);

Example

foreach (decoded; Base64.decoder(stdin.byLine()))
{
    writeln(decoded);
}

In addition, You can use Decoder that returns decoded single character. This Decoder performs Range-based and lazy decoding.

Example

auto encoded = Base64.encoder(cast(ubyte[])"0123456789");
foreach (n; map!q{a - '0'}(Base64.decoder(encoded)))
{
    writeln(n);
}

NOTE

If you use ByChunk, chunk-size should be the multiple of 4. Decoder can't judge a encode-boundary.

Parameters

NameDescription
range an InputRange to iterate.

Returns

a Decoder object instantiated and initialized according to the arguments.

Struct Base64Impl.Decoder

Range that decodes chunk data at a time.

Properties

Name Type Description
empty [get] bool Range primitive operation that checks iteration state.
front [get] ubyte[] Range primitive operation that returns the currently iterated element.

Methods

Name Description
popFront Range primitive operation that advances the range to its next element.

Struct Base64Impl.Decoder

Range that decodes single character at a time.

Properties

Name Type Description
empty [get] bool Range primitive operation that checks iteration state.
front [get] ubyte Range primitive operation that returns the currently iterated element.

Methods

Name Description
popFront Range primitive operation that advances the range to its next element.

Authors

Masahiro Nakagawa, Daniel Murphy (Single value Encoder and Decoder)

License

Boost License 1.0.

Comments