iopipe.textpipe

Text handling with iopipe.

Members

Enums

UTFType
enum UTFType

Used to specify stream type

Functions

assumeText
auto assumeText(Chain c)

Given an ioPipe whose window is a buffer that is a dynamic array of data of integral type, performs the proper transformations in order to get a buffer of valid char, wchar, or dchar elements, depending on the provided encoding. This function is useful for when you have data from a raw source (such as a file or stream) that you have determined or know is really a stream of UTF data.

byDelimRange
auto byDelimRange(Chain c, dchar delim)

Given a text iopipe, returns a range based on splitting the text by a given code point. This has the advantage over delimitedText.asRange in that the delimiter can be hidden.

byLine
auto byLine(Chain c)

A convenience wrapper for delimitedText that uses the newline character '\n' to delimit the segments. Equivalent to delimitedText(c, '\n');

byLineRange
auto byLineRange(Chain c)

Convenience wrapper for byDelimRange that uses the newline character '\n' as the delimiter. Equivalent to `byDelimRange!(KeepDelimiter)(c, '\n');

convertText
auto convertText(Chain chain)

Convert iopipe of one text type into an iopipe for another type. Performs conversions at the code-point level. If specified, the resulting iopipe will ensure there is a BOM at the beginning of the iopipe. This is useful if writing to storage.

delimitedText
auto delimitedText(Chain c, dchar delim)

Process a given text iopipe by a given code point delimeter. The only behavior that changes from the input pipe is that extensions to the window deliever exactly one more delimited segment of text.

detectBOM
UTFType detectBOM(R r)

Using the given random access range of bytes, determine the stream width. This does not advance the range past the BOM.

encodeText
auto encodeText(Chain c)

Encode a given text iopipe into the desired encoding type. The resulting iopipe's element type is ubyte, with the bytes ready to be written to a storage device.

ensureDecodeable
auto ensureDecodeable(Chain c)

Wraps a text-based iopipe to make sure all code units are decodeable.

runEncoded
auto ref runEncoded(Chain c, Args args)

Given a template function, and an input chain of encoded text data, this function will detect the encoding of the input chain, and convert that runtime value into a compile-time parameter to the given function. Useful for writing code that needs to handle all the forms of text encoding.

runWithEncoding
auto ref runWithEncoding(Chain c, Args args)

Given a template function, and an input chain of encoded text data, this function will detect the encoding of the input chain, and convert that runtime value into a compile-time parameter to the given function. Useful for writing code that needs to handle all the forms of text encoding.

textOutput
auto textOutput(Chain c)

Take a text-based iopipe and turn it into an output range of dchar. Note that the iopipe must be an output iopipe, not an input one. In other words, a textOutput result doesn't output its input, it uses its input as a place to deposit data.

Structs

DecodeableWindow
struct DecodeableWindow(Chain, CodeUnitType)
Undocumented in source.
TextOutput
struct TextOutput(Chain)
Undocumented in source.

Templates

CodeUnit
template CodeUnit(UTFType u)

Aliased to code unit type of a specified stream type.

textConverter
template textConverter(bool ensureBOM = false, Chain)

A converter to allow conversion into any other type of text.

Meta

License

Boost License 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Authors

Steven Schveighoffer