Module iopipe.textpipe

Text handling with iopipe.

Functions

NameDescription
assumeText(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(c, 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(c)A convenience wrapper for delimitedText that uses the newline character '\n' to delimit the segments. Equivalent to delimitedText(c, '\n');
byLineRange(c)Convenience wrapper for byDelimRange that uses the newline character '\n' as the delimiter. Equivalent to `byDelimRange!(KeepDelimiter)(c, '\n');
convertText(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(c, 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(r)Using the given random access range of bytes, determine the stream width. This does not advance the range past the BOM.
encodeText(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(c)Wraps a text-based iopipe to make sure all code units are decodeable.
runEncoded(c, 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(c, 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.
textConverter(c)A converter to allow conversion into any other type of text.
textOutput(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.

Enums

NameDescription
UTFTypeUsed to specify stream type

Templates

NameDescription
CodeUnitAliased to code unit type of a specified stream type.