Logo Search packages:      
Sourcecode: icu version File versions  Download package

#define U16_PREV ( s,


{ \
    (c)=(s)[--(i)]; \
    if(U16_IS_TRAIL(c)) { \
        uint16_t __c2; \
        if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
            --(i); \
            (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
        } \
    } \
Move the string offset from one code point boundary to the previous one and get the code point between them. (Pre-decrementing backward iteration.) "Safe" macro, handles unpaired surrogates and checks for string boundaries.

The input offset may be the same as the string length. If the offset is behind a trail surrogate unit for a supplementary code point, then the macro will read the preceding lead surrogate as well. If the offset is behind a lead surrogate or behind a single, unpaired trail surrogate, then that itself will be returned as the code point.

s const UChar * string
start starting string offset (usually 0)
i string offset, must be start<i
c output UChar32 variable
See also:

Definition at line 485 of file utf16.h.

Referenced by UnicodeSet::spanBack(), and UnicodeString::trim().

Generated by  Doxygen 1.6.0   Back to index