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

#define U8_APPEND ( s,
i,
capacity,
c,
isError   ) 

Value:

{ \
    if((uint32_t)(c)<=0x7f) { \
        (s)[(i)++]=(uint8_t)(c); \
    } else if((uint32_t)(c)<=0x7ff && (i)+1<(capacity)) { \
        (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \
        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
    } else if((uint32_t)(c)<=0xd7ff && (i)+2<(capacity)) { \
        (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
        (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
    } else { \
        (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(capacity), c, &(isError)); \
    } \
}
Append a code point to a string, overwriting 1 to 4 bytes. The offset points to the current end of the string contents and is advanced (post-increment). "Safe" macro, checks for a valid code point. If a non-ASCII code point is written, checks for sufficient space in the string. If the code point is not valid or trail bytes do not fit, then isError is set to TRUE.

Parameters:
s const uint8_t * string buffer
i string offset, must be i<capacity
capacity size of the string buffer
c code point to append
isError output UBool set to TRUE if an error occurs, otherwise not modified
See also:
U8_APPEND_UNSAFE ICU 2.4

Definition at line 361 of file utf8.h.


Generated by  Doxygen 1.6.0   Back to index