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

#define U8_PREV ( s,
start,
i,
 ) 

Value:

{ \
    (c)=(uint8_t)(s)[--(i)]; \
    if((c)>=0x80) { \
        if((c)<=0xbf) { \
            (c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -1); \
        } else { \
            (c)=U_SENTINEL; \
        } \
    } \
}
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, checks for illegal sequences and for string boundaries.

The input offset may be the same as the string length. If the offset is behind a multi-byte sequence, then the macro will read the whole sequence. If the offset is behind a lead byte, then that itself will be returned as the code point. If the offset is behind an illegal UTF-8 sequence, then c is set to a negative value.

Parameters:
s const uint8_t * string
start starting string offset (usually 0)
i string offset, must be start<i
c output UChar32 variable, set to <0 in case of an error
See also:
U8_PREV_UNSAFE ICU 2.4

Definition at line 556 of file utf8.h.

Referenced by UnicodeSet::spanBackUTF8().


Generated by  Doxygen 1.6.0   Back to index