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.encoder - multiple declarations
- Function Base64Impl.encoder
- Struct Base64Impl.Encoder
- Struct Base64Impl.Encoder
Function Base64Impl.encoder
Iterates through an InputRange at a time by using .
Encoder
Default encodes chunk data.
Encoder
Prototype
Base64Impl.Encoder!Range encoder(Range)( Range range ) if (isInputRange!Range);
Example
File f = File("text.txt", "r");
scope(exit) f.close();
uint line = 0;
foreach (encoded; Base64.encoder(f.byLine()))
{
writeln(++line, ". ", encoded);
}
In addition, You can use that returns encoded single character.
This Encoder performs Range-based and lazy encoding.
Encoder
Example
ubyte[] data = cast(ubyte[]) "0123456789";
// The ElementType of data is not aggregation type
foreach (encoded; Base64.encoder(data))
{
writeln(encoded);
}
Parameters
| Name | Description |
|---|---|
| range | an InputRange to iterate. |
Returns
a Encoderobject instantiated and initialized according to the arguments.
Struct Base64Impl.Encoder
Range that encodes chunk data at a time.
Properties
| Name | Type | Description |
|---|---|---|
empty
[get]
|
bool |
Range primitive operation that checks iteration state. |
front
[get]
|
char[] |
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.Encoder
Range that encodes 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)