]>
git.saurik.com Git - apple/icu.git/blob - icuSources/tools/genrb/rle.h
2 *******************************************************************************
4 * Copyright (C) 2000, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
11 * Modification History:
13 * Date Name Description
14 * 01/11/02 Ram Creation.
15 *******************************************************************************
21 #include "unicode/utypes.h"
22 #include "unicode/ustring.h"
26 * Construct a string representing a byte array. Use run-length encoding.
27 * Two bytes are packed into a single char, with a single extra zero byte at
28 * the end if needed. A byte represents itself, unless it is the
29 * ESCAPE_BYTE. Then the following notations are possible:
30 * ESCAPE_BYTE ESCAPE_BYTE ESCAPE_BYTE literal
31 * ESCAPE_BYTE n b n instances of byte b
32 * Since an encoded run occupies 3 bytes, we only encode runs of 4 or
33 * more bytes. Thus we have n > 0 and n != ESCAPE_BYTE and n <= 0xFF.
34 * If we encounter a run where n == ESCAPE_BYTE, we represent this as:
36 * The ESCAPE_BYTE value is chosen so as not to collide with commonly
40 byteArrayToRLEString(const uint8_t* src
,int32_t srcLen
, uint16_t* buffer
,int32_t bufLen
, UErrorCode
* status
);
44 * Construct a string representing a char array. Use run-length encoding.
45 * A character represents itself, unless it is the ESCAPE character. Then
46 * the following notations are possible:
47 * ESCAPE ESCAPE ESCAPE literal
48 * ESCAPE n c n instances of character c
49 * Since an encoded run occupies 3 characters, we only encode runs of 4 or
50 * more characters. Thus we have n > 0 and n != ESCAPE and n <= 0xFFFF.
51 * If we encounter a run where n == ESCAPE, we represent this as:
53 * The ESCAPE value is chosen so as not to collide with commonly
57 usArrayToRLEString(const uint16_t* src
,int32_t srcLen
,uint16_t* buffer
, int32_t bufLen
,UErrorCode
* status
);
60 * Construct an array of bytes from a run-length encoded string.
63 rleStringToByteArray(uint16_t* src
, int32_t srcLen
, uint8_t* target
, int32_t tgtLen
, UErrorCode
* status
);
65 * Construct an array of shorts from a run-length encoded string.
68 rleStringToUCharArray(uint16_t* src
, int32_t srcLen
, uint16_t* target
, int32_t tgtLen
, UErrorCode
* status
);