Inheritance diagram for UConverter:
Public Member Functions | |
this (char[] name) | |
~this () | |
void | reset () |
void | resetDecoder () |
void | resetEncoder () |
ubyte | getMaxCharSize () |
ubyte | getMinCharSize () |
char[] | getName () |
bool | isAmbiguous () |
bool | encode (wchar[] input, void[] output, inout UAdjust x, bool flush) |
uint | encode (wchar[] input, void[] output) |
bool | decode (void[] input, wchar[] output, inout UAdjust x, bool flush) |
uint | decode (void[] input, wchar[] output) |
ITranscoder | createTranscoder (UConverter dst) |
Static Public Member Functions | |
int | compareNames (char[] a, char[] b) |
char[] | detectSignature (void[] input) |
int | opApply (int(*dg)(inout char[] element)) |
this () | |
~this () | |
Static Public Attributes | |
FunctionLoader Bind[] | targets |
Private Types | |
typedef void * | Handle |
enum | Error { OK, BufferOverflow = 15 } |
Static Private Member Functions | |
bool | isError (Error e) |
void | testError (Error e, char[] msg) |
char * | toString (char[] string) |
wchar * | toString (wchar[] string) |
uint | length (char *s) |
uint | length (wchar *s) |
char[] | toArray (char *s) |
wchar[] | toArray (wchar *s) |
Private Attributes | |
Handle | handle |
Static Private Attributes | |
void * | library |
Since many software programs recogize different converter names for different types of converters, there are other functions in this API to iterate over the converter aliases.
See this page for full details.
Definition at line 126 of file UConverter.d.
|
Use this for the primary argument-type to most ICU functions |
|
ICU error codes (the ones which are referenced) |
|
Deletes the unicode converter and releases resources associated with just this instance. Does not free up shared converter tables. Definition at line 176 of file UConverter.d. |
|
Definition at line 760 of file UConverter.d. |
|
Creates a UConverter object with the names specified as a string. The actual name will be resolved with the alias file using a case-insensitive string comparison that ignores delimiters '-', '_', and ' ' (dash, underscore, and space). E.g., the names "UTF8", "utf-8", and "Utf 8" are all equivalent. If null is passed for the converter name, it will create one with the getDefaultName() return value. A converter name may contain options like a locale specification to control the specific behavior of the converter instantiated. The meaning of the options depends on the particular converter: if an option is not defined for or recognized, it is ignored. Options are appended to the converter name string, with an OptionSepChar between the name and the first option and also between adjacent options. The conversion behavior and names can vary between platforms, and ICU may convert some characters differently from other platforms. Details on this topic are in the User's Guide. Definition at line 159 of file UConverter.d. References ICU::isError(). |
|
Do a fuzzy compare of two converter/alias names. The comparison is case-insensitive. It also ignores the characters '-', '_', and ' ' (dash, underscore, and space). Thus the strings "UTF-8", "utf_8", and "Utf 8" are exactly equivalent Definition at line 191 of file UConverter.d. References ICU::toString(). |
|
Resets the state of this converter to the default state. This is used in the case of an error, to restart a conversion from a known default state. It will also empty the internal output buffers. Definition at line 206 of file UConverter.d. |
|
Resets the from-Unicode part of this converter state to the default state. This is used in the case of an error to restart a conversion from Unicode to a known default state. It will also empty the internal output buffers used for the conversion from Unicode codepoints. Definition at line 223 of file UConverter.d. |
|
Resets the from-Unicode part of this converter state to the default state. This is used in the case of an error to restart a conversion from Unicode to a known default state. It will also empty the internal output buffers used for the conversion from Unicode codepoints. Definition at line 240 of file UConverter.d. |
|
Returns the maximum number of bytes that are output per UChar in conversion from Unicode using this converter. The returned number can be used to calculate the size of a target buffer for conversion from Unicode. This number may not be the same as the maximum number of bytes per "conversion unit". In other words, it may not be the intuitively expected number of bytes per character that would be published for a charset, and may not fulfill any other purpose than the allocation of an output buffer of guaranteed sufficient size for a given input length and converter. Examples for special cases that are taken into account: Supplementary code points may convert to more bytes than BMP code points. This function returns bytes per UChar (UTF-16 code unit), not per Unicode code point, for efficient buffer allocation. State-shifting output (SI/SO, escapes, etc.) from stateful converters. When m input UChars are converted to n output bytes, then the maximum m/n is taken into account. The number returned here does not take into account: callbacks which output more than one charset character sequence per call, like escape callbacks initial and final non-character bytes that are output by some converters (automatic BOMs, initial escape sequence, final SI, etc.) Examples for returned values: SBCS charsets: 1 Shift-JIS: 2 UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted) UTF-8: 3 (3 per BMP, 4 per surrogate _pair_) EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS) ISO-2022: 3 (always outputs UTF-8) ISO-2022-JP: 6 (4-byte escape sequences + DBCS) ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS) Definition at line 294 of file UConverter.d. |
|
Returns the minimum byte length for characters in this codepage. This is usually either 1 or 2. Definition at line 306 of file UConverter.d. |
|
Gets the internal, canonical name of the converter (zero- terminated). Definition at line 318 of file UConverter.d. References ICU::testError(), and ICU::toArray(). |
|
Determines if the converter contains ambiguous mappings of the same character or not Definition at line 334 of file UConverter.d. |
|
Detects Unicode signature byte sequences at the start of the byte stream and returns the charset name of the indicated Unicode charset. A null is returned where no Unicode signature is recognized. A caller can create a UConverter using the charset name. The first code unit (wchar) from the start of the stream will be U+FEFF (the Unicode BOM/signature character) and can usually be ignored. Definition at line 353 of file UConverter.d. References ICU::isError(), and ICU::toArray(). |
|
Converts an array of unicode characters to an array of codepage characters. This function is optimized for converting a continuous stream of data in buffer-sized chunks, where the entire source and target does not fit in available buffers. The source pointer is an in/out parameter. It starts out pointing where the conversion is to begin, and ends up pointing after the last UChar consumed. Target similarly starts out pointer at the first available byte in the output buffer, and ends up pointing after the last byte written to the output. The converter always attempts to consume the entire source buffer, unless (1.) the target buffer is full, or (2.) a failing error is returned from the current callback function. When a successful error status has been returned, it means that all of the source buffer has been consumed. At that point, the caller should reset the source and sourceLimit pointers to point to the next chunk. At the end of the stream (flush==true), the input is completely consumed when *source==sourceLimit and no error code is set. The converter object is then automatically reset by this function. (This means that a converter need not be reset explicitly between data streams if it finishes the previous stream without errors.) This is a stateful conversion. Additionally, even when all source data has been consumed, some data may be in the converters' internal state. Call this function repeatedly, updating the target pointers with the next empty chunk of target in case of a U_BUFFER_OVERFLOW_ERROR, and updating the source pointers with the next chunk of source when a successful error status is returned, until there are no more chunks of source data. Parameters: converter the Unicode converter target I/O parameter. Input : Points to the beginning of the buffer to copy codepage characters to. Output : points to after the last codepage character copied to target. targetLimit the pointer just after last of the target buffer source I/O parameter, pointer to pointer to the source Unicode character buffer. sourceLimit the pointer just after the last of the source buffer offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number of allocated cells as target. Will fill in offsets from target to source pointer e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] For output data carried across calls, and other data without a specific source character (such as from escape sequences or callbacks) -1 will be placed for offsets. flush set to TRUE if the current source buffer is the last available chunk of the source, FALSE otherwise. Note that if a failing status is returned, this function may have to be called multiple times with flush set to TRUE until the source buffer is consumed. Definition at line 441 of file UConverter.d. References ICU::testError(). |
|
Encode the Unicode string into a codepage string. This function is a more convenient but less powerful version of encode(). It is only useful for whole strings, not for streaming conversion. The maximum output buffer capacity required (barring output from callbacks) should be calculated using getMaxCharSize(). Definition at line 472 of file UConverter.d. References ICU::testError(). |
|
Converts a buffer of codepage bytes into an array of unicode UChars characters. This function is optimized for converting a continuous stream of data in buffer-sized chunks, where the entire source and target does not fit in available buffers. The source pointer is an in/out parameter. It starts out pointing where the conversion is to begin, and ends up pointing after the last byte of source consumed. Target similarly starts out pointer at the first available UChar in the output buffer, and ends up pointing after the last UChar written to the output. It does NOT necessarily keep UChar sequences together. The converter always attempts to consume the entire source buffer, unless (1.) the target buffer is full, or (2.) a failing error is returned from the current callback function. When a successful error status has been returned, it means that all of the source buffer has been consumed. At that point, the caller should reset the source and sourceLimit pointers to point to the next chunk. At the end of the stream (flush==true), the input is completely consumed when *source==sourceLimit and no error code is set The converter object is then automatically reset by this function. (This means that a converter need not be reset explicitly between data streams if it finishes the previous stream without errors.) This is a stateful conversion. Additionally, even when all source data has been consumed, some data may be in the converters' internal state. Call this function repeatedly, updating the target pointers with the next empty chunk of target in case of a BufferOverflow, and updating the source pointers with the next chunk of source when a successful error status is returned, until there are no more chunks of source data. Parameters: converter the Unicode converter target I/O parameter. Input : Points to the beginning of the buffer to copy UChars into. Output : points to after the last UChar copied. targetLimit the pointer just after the end of the target buffer source I/O parameter, pointer to pointer to the source codepage buffer. sourceLimit the pointer to the byte after the end of the source buffer offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number of allocated cells as target. Will fill in offsets from target to source pointer e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] For output data carried across calls, and other data without a specific source character (such as from escape sequences or callbacks) -1 will be placed for offsets. flush set to true if the current source buffer is the last available chunk of the source, false otherwise. Note that if a failing status is returned, this function may have to be called multiple times with flush set to true until the source buffer is consumed. Definition at line 552 of file UConverter.d. References ICU::testError(). |
|
Decode the codepage string into a Unicode string. This function is a more convenient but less powerful version of decode(). It is only useful for whole strings, not for streaming conversion. The maximum output buffer capacity required (barring output from callbacks) will be 2*src.length (each char may be converted into a surrogate pair) Definition at line 583 of file UConverter.d. References ICU::testError(). |
|
Iterate over the available converter names Definition at line 599 of file UConverter.d. References ICU::toArray(). |
|
Definition at line 619 of file UConverter.d. |
|
Definition at line 747 of file UConverter.d. |
|
Definition at line 110 of file ICU.d. Referenced by detectSignature(), UString::format(), UCollator::getLocale(), and this(). |
|
|
|
Definition at line 160 of file ICU.d. References string. |
|
Definition at line 182 of file ICU.d. References strlen(). |
|
Definition at line 191 of file ICU.d. References wcslen(). |
|
Definition at line 200 of file ICU.d. References strlen(). Referenced by detectSignature(), UResourceBundle::getKey(), UResourceBundle::getLocale(), UMessageFormat::getLocale(), UCollator::getLocale(), getName(), UChar::getPropertyName(), UChar::getPropertyValueName(), and opApply(). |
|
Definition at line 211 of file ICU.d. References wcslen(). |
|
Definition at line 128 of file UConverter.d. Referenced by UConverter::UTranscoder::convert(). |
|
Bind the ICU functions from a shared library. This is complicated by the issues regarding D and DLLs on the Windows platform Definition at line 689 of file UConverter.d. |
|
Initial value: [ {cast(void**) &ucnv_open, "ucnv_open"} Definition at line 721 of file UConverter.d. |