Ejemplo n.º 1
0
/* Get length of next grapheme
 */
size_t linenoiseUtf8NextCharLen(const char* buf, size_t buf_len, size_t pos, size_t *col_len) {
    size_t beg = pos;
    int cp;
    size_t len = utf8BytesToCodePoint(buf + pos, buf_len - pos, &cp);
    if (isCombiningChar(cp)) {
        /* NOTREACHED */
        return 0;
    }
    if (col_len != NULL) *col_len = isWideChar(cp) ? 2 : 1;
    pos += len;
    while (pos < buf_len) {
        int cp;
        len = utf8BytesToCodePoint(buf + pos, buf_len - pos, &cp);
        if (!isCombiningChar(cp)) return pos - beg;
        pos += len;
    }
    return pos - beg;
}
Ejemplo n.º 2
0
/*!
   \internal

   Determines whether \a c is a valid instance of
   production [4]NameChar in the XML 1.0 specification. If it
   is, true is returned, otherwise false.

    \sa \l {http://www.w3.org/TR/REC-xml/#NT-NameChar}
           {Extensible Markup Language (XML) 1.0 (Fourth Edition), [4] NameChar}
 */
bool QXmlUtils::isNameChar(const QChar c)
{
    return isBaseChar(c)
           || isDigit(c)
           || c.unicode() == '.'
           || c.unicode() == '-'
           || c.unicode() == '_'
           || c.unicode() == ':'
           || isCombiningChar(c)
           || isIdeographic(c)
           || isExtender(c);
}
Ejemplo n.º 3
0
/****************************************************************************
Desc:		Returns TRUE if the character is a valid XML naming character
****************************************************************************/
FLMBOOL FLMAPI F_XML::isNCNameChar(
	FLMUNICODE		uChar)
{
	if( isLetter( uChar) ||
		isDigit( uChar) ||
		uChar == FLM_UNICODE_PERIOD ||
		uChar == FLM_UNICODE_HYPHEN ||
		uChar == FLM_UNICODE_UNDERSCORE ||
		isCombiningChar( uChar) || isExtender( uChar))
	{
		return( TRUE);
	}

	return( FALSE);
}
Ejemplo n.º 4
0
/* Get length of previous grapheme
 */
size_t linenoiseUtf8PrevCharLen(const char* buf, size_t buf_len, size_t pos, size_t *col_len) {
    UNUSED(buf_len);
    size_t end = pos;
    while (pos > 0) {
        size_t len = prevUtf8CharLen(buf, pos);
        pos -= len;
        int cp;
        utf8BytesToCodePoint(buf + pos, len, &cp);
        if (!isCombiningChar(cp)) {
            if (col_len != NULL) *col_len = isWideChar(cp) ? 2 : 1;
            return end - pos;
        }
    }
    /* NOTREACHED */
    return 0;
}
Ejemplo n.º 5
0
bool XQCharType::isNameChar(uint32_t cp)
{
  return (cp == '.') || (cp == '-') || (cp == '_') || (cp == ':') ||
        isLetter(cp) || isDigit(cp) || isCombiningChar(cp) || isExtender(cp);
}