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.
Use the encoding type as a parameter to assumeText to get an iopipe of
char, wchar, or dchar elements for processing.
Note that func must return the same type no matter how it's called, as the
BOM detection and calling is done at runtime. Given that there are 5
different encodings that iopipe handles, you will have 6 instantiations of
the function, no matter whether the input contains that encoding or not.
The second version assumes that the function doesn't care what the encoding
is, but just wants to get a text iopipe with the appropriate encoding
already handled. In this case, the function will receive a chain of char,
wchar, or dchar window elements.
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.
Use the encoding type as a parameter to assumeText to get an iopipe of char, wchar, or dchar elements for processing.
Note that func must return the same type no matter how it's called, as the BOM detection and calling is done at runtime. Given that there are 5 different encodings that iopipe handles, you will have 6 instantiations of the function, no matter whether the input contains that encoding or not.
The second version assumes that the function doesn't care what the encoding is, but just wants to get a text iopipe with the appropriate encoding already handled. In this case, the function will receive a chain of char, wchar, or dchar window elements.