当前位置: 首页>>代码示例>>C++>>正文


C++ QChar::row方法代码示例

本文整理汇总了C++中QChar::row方法的典型用法代码示例。如果您正苦于以下问题:C++ QChar::row方法的具体用法?C++ QChar::row怎么用?C++ QChar::row使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QChar的用法示例。


在下文中一共展示了QChar::row方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: convertFromUnicode

QByteArray QEucJpCodec::convertFromUnicode(const QChar *uc, int len, ConverterState *state) const
{
    char replacement = '?';
    if (state) {
        if (state->flags & ConvertInvalidToNull)
            replacement = 0;
    }
    int invalid = 0;

    int rlen = 3*len + 1;
    QByteArray rstr;
    rstr.resize(rlen);
    uchar* cursor = (uchar*)rstr.data();
    for (int i = 0; i < len; i++) {
        QChar ch = uc[i];
        uint j;
        if (ch.unicode() < 0x80) {
            // ASCII
            *cursor++ = ch.cell();
        } else if ((j = conv->unicodeToJisx0201(ch.row(), ch.cell())) != 0) {
            if (j < 0x80) {
                // JIS X 0201 Latin ?
                *cursor++ = j;
            } else {
                // JIS X 0201 Kana
                *cursor++ = Ss2;
                *cursor++ = j;
            }
        } else if ((j = conv->unicodeToJisx0208(ch.row(), ch.cell())) != 0) {
            // JIS X 0208
            *cursor++ = (j >> 8)   | 0x80;
            *cursor++ = (j & 0xff) | 0x80;
        } else if ((j = conv->unicodeToJisx0212(ch.row(), ch.cell())) != 0) {
开发者ID:Cahya,项目名称:phantomjs,代码行数:33,代码来源:qeucjpcodec.cpp

示例2: fromUnicode

/*!
  \reimp
*/
QCString QEucJpCodec::fromUnicode(const QString& uc, int& lenInOut) const
{
    int l = QMIN((int)uc.length(),lenInOut);
    int rlen = l*3+1;
    QCString rstr(rlen);
    uchar* cursor = (uchar*)rstr.data();
    for (int i=0; i<l; i++) {
	QChar ch = uc[i];
	uint j;
	if ( ch.row() == 0x00 && ch.cell() < 0x80 ) {
	    // ASCII
	    *cursor++ = ch.cell();
	} else if ((j = conv->unicodeToJisx0201(ch.row(), ch.cell())) != 0) {
	    if (j < 0x80) {
		// JIS X 0201 Latin ?
		*cursor++ = j;
	    } else {
		// JIS X 0201 Kana
		*cursor++ = Ss2;
		*cursor++ = j;
	    }
	} else if ((j = conv->unicodeToJisx0208(ch.row(), ch.cell())) != 0) {
	    // JIS X 0208
	    *cursor++ = (j >> 8)   | 0x80;
	    *cursor++ = (j & 0xff) | 0x80;
	} else if ((j = conv->unicodeToJisx0212(ch.row(), ch.cell())) != 0) {
开发者ID:aroraujjwal,项目名称:qt3,代码行数:29,代码来源:qeucjpcodec.cpp

示例3: convertFromUnicode

QByteArray QSjisCodec::convertFromUnicode(const ushort* uc, int len, ConverterState *state)
{
    char replacement = '?';
    if (state) {
        if (state->flags & ConvertInvalidToNull)
            replacement = 0;
    }
    int invalid = 0;

    int rlen = 2*len + 1;
    QByteArray rstr;
    rstr.resize(rlen);
    uchar* cursor = (uchar*)rstr.data();
    for (int i = 0; i < len; i++) {
        QChar ch = uc[i];
        uint j;
        if (ch.row() == 0x00 && ch.cell() < 0x80) {
            // ASCII
            *cursor++ = ch.cell();
        } else if ((j = conv->unicodeToJisx0201(ch.row(), ch.cell())) != 0) {
            // JIS X 0201 Latin or JIS X 0201 Kana
            *cursor++ = j;
        } else if ((j = conv->unicodeToSjis(ch.row(), ch.cell())) != 0) {
            // JIS X 0208
            *cursor++ = (j >> 8);
            *cursor++ = (j & 0xff);
        } else if ((j = conv->unicodeToSjisibmvdc(ch.row(), ch.cell())) != 0) {
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:27,代码来源:qsjiscodec.cpp

示例4: fromUnicode

/*! \internal */
QCString QJisCodec::fromUnicode(const QString& uc, int& len_in_out) const
{
    int l = QMIN((int)uc.length(),len_in_out);
    QCString result;
    Iso2022State state = Ascii;
    Iso2022State prev = Ascii;
    for (int i=0; i<l; i++) {
	QChar ch = uc[i];
	uint j;
	if ( ch.row() == 0x00 && ch.cell() < 0x80 ) {
	    // Ascii
	    if (state != JISX0201_Latin ||
		ch.cell() == ReverseSolidus || ch.cell() == Tilde) {
		state = Ascii;
	    }
	    j = ch.cell();
	} else if ((j = conv->UnicodeToJisx0201(ch.row(), ch.cell())) != 0) {
	    if (j < 0x80) {
		// JIS X 0201 Latin
		if (state != Ascii ||
		    ch.cell() == YenSign || ch.cell() == Overline) {
		    state = JISX0201_Latin;
		}
	    } else {
		// JIS X 0201 Kana
		state = JISX0201_Kana;
		j &= 0x7f;
	    }
	} else if ((j = conv->UnicodeToJisx0208(ch.row(), ch.cell())) != 0) {
	    // JIS X 0208
	    state = JISX0208_1983;
	} else if ((j = conv->UnicodeToJisx0212(ch.row(), ch.cell())) != 0) {
	    // JIS X 0212
	    state = JISX0212;
	} else {
	    // Invalid
	    state = Unknown;
	    j = '?';
	}
	if (state != prev) {
	    if (state == Unknown) {
		result += Esc_Ascii;
	    } else {
		result += Esc_SEQ[state - MinState];
	    }
	    prev = state;
	}
	if (j < 0x0100) {
	    result += j & 0xff;
	} else {
	    result += (j >> 8) & 0xff;
	    result += j & 0xff;
	}
    }
    if (prev != Ascii) {
	result += Esc_Ascii;
    }
    len_in_out = result.length();
    return result;
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:61,代码来源:qjiscodec.cpp

示例5: if

static bool to8bit(const QChar ch, QCString *rstr)
{
    bool converted = FALSE;

    if( ch.isMark() ) return TRUE; // ignore marks for conversion

    if ( ch.row() ) {
	if ( ch.row() == 0x05 ) {
	    if ( ch.cell() > 0x91 )
		converted = TRUE;
	    // 0x0591 - 0x05cf: Hebrew punctuation... dropped
	    if ( ch.cell() >= 0xD0 )
		*rstr += (char)unicode_to_heb_05[ch.cell()- 0xD0];
	} else if ( ch.row() == 0x20 ) {
	    if ( ch.cell() == 0x3E ) {
		*rstr += (char)0xAF;
		converted = TRUE;
	    } else if ( ch.cell() == 0x17 ) {
		*rstr += (char)0xCF;
		converted = TRUE;
	    }
	} else {
	    converted = FALSE;
	}
    } else {
	if ( ch.cell() < 0x80 ) {
	    *rstr += (char)ch.cell();
	    converted = TRUE;
	} else if( ch.cell() < 0xA0 ) {
	    *rstr += (char)unicode_to_heb_00[ch.cell() - 0x80];
	    converted = TRUE;
	}
    }

    if(converted) return TRUE;

    // couldn't convert the char... lets try its decomposition
    QString d = ch.decomposition();
    if(d.isNull())
	return FALSE;

    int l = d.length();
    for (int i=0; i<l; i++) {
	const QChar ch = d[i];

	if(to8bit(ch, rstr))
	    converted = TRUE;
    }

    return converted;
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:51,代码来源:qrtlcodec.cpp

示例6: fromUnicode

/*! \reimp */
QCString QTsciiCodec::fromUnicode(const QString& uc, int& lenInOut) const
{
    int l = QMIN((int)uc.length(), lenInOut);
    int rlen = l+1;
    QCString rstr(rlen);
    uchar* cursor = (uchar*)rstr.data();
    for (int i = 0; i < l; i++) {
	QChar ch = uc[i];
	uchar j;
	if ( ch.row() == 0x00 && ch.cell() < 0x80 ) {
	    // ASCII
	    j = ch.cell();
	} else if ((j = qt_UnicodeToTSCII(uc[i].unicode(),
					  uc[i + 1].unicode(),
					  uc[i + 2].unicode()))) {
	    // We have to check the combined chars first!
	    i += 2;
	} else if ((j = qt_UnicodeToTSCII(uc[i].unicode(),
					  uc[i + 1].unicode(), 0))) {
	    i++;
	} else if ((j = qt_UnicodeToTSCII(uc[i].unicode(), 0, 0))) {
	} else {
	    // Error
	    j = '?';	// unknown char
	}
	*cursor++ = j;
    }
    lenInOut = cursor - (uchar*)rstr.data();
    *cursor = 0;
    return rstr;
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:32,代码来源:qtsciicodec.cpp

示例7: matchcharclass

static bool matchcharclass( uint *rxd, QChar c )
{
    uint *d = rxd;
    uint clcode = *d & MCD;
    bool neg = clcode == CCN;
    if ( clcode != CCL && clcode != CCN)
	qWarning("QRegExp: Internal error, please report to [email protected]");
    uint numFields = *d & MVL;
    uint cval = (((uint)(c.row())) << 8) | ((uint)c.cell());
    bool found = FALSE;
    for ( int i = 0; i < (int)numFields; i++ ) {
	d++;
	if ( *d == PWS && c.isSpace() ) {
	    found = TRUE;
	    break;
	}
	if ( *d == PDG && c.isDigit() ) {
	    found = TRUE;
	    break;
	}
	else {
	    uint from = ( *d & MCD ) >> 16;
	    uint to = *d & MVL;
	    if ( (cval >= from) && (cval <= to) ) {
		found = TRUE;
		break;
	    }
	}
    }
    return neg ? !found : found;
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:31,代码来源:qregexp.cpp

示例8: encodeFileName

	void encodeFileName(QString & szPath)
	{
		QString szSrc(szPath);
		szPath = "";
		for(int i = 0; i < szSrc.length(); i++)
		{
			QChar cur = szSrc[i];
			if( ! (cur.isLetter() || cur.isDigit() || cur==' ' || cur=='_' || cur=='.' || cur=='#' || cur=='%') )
			{
				if(cur.row()!=0)
				{
					szPath += '%';
					szPath += cHexChars[cur.row() >> 4];
					szPath += cHexChars[cur.row() & 15];
				}
				szPath += '%';
				szPath += cHexChars[cur.cell() >> 4];
				szPath += cHexChars[cur.cell() & 15];
			} else if (cur=='%')
开发者ID:DINKIN,项目名称:KVIrc,代码行数:19,代码来源:KviFileUtils.cpp

示例9: fromUnicode

/*!
  \reimp
*/
QCString QSjisCodec::fromUnicode(const QString& uc, int& len_in_out) const
{
    int l = QMIN((int)uc.length(),len_in_out);
    int rlen = l*2+1;
    QCString rstr(rlen);
    uchar* cursor = (uchar*)rstr.data();
    for (int i=0; i<l; i++) {
	QChar ch = uc[i];
	uint j;
	if ( ch.row() == 0x00 && ch.cell() < 0x80 ) {
	    // ASCII
	    *cursor++ = ch.cell();
	} else if ((j = conv->UnicodeToJisx0201(ch.row(), ch.cell())) != 0) {
	    // JIS X 0201 Latin or JIS X 0201 Kana
	    *cursor++ = j;
	} else if ((j = conv->UnicodeToSjis(ch.row(), ch.cell())) != 0) {
	    // JIS X 0208
	    *cursor++ = (j >> 8);
	    *cursor++ = (j & 0xff);
	} else if ((j = conv->UnicodeToJisx0212(ch.row(), ch.cell())) != 0) {
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:23,代码来源:qsjiscodec.cpp

示例10: rstr

QCString QKoi8Codec::fromUnicode(const QString& uc, int& len_in_out) const
{
    int l = QMIN((int)uc.length(),len_in_out);
    int rlen = l+1;
    QCString rstr(rlen);
    uchar* cursor = (uchar*)rstr.data();
    for (int i=0; i<l; i++) {
	const QChar ch = uc[i];
	if ( ch.row() ) {
	    if ( ch.row() == 0x25 ) {
		if ( ch.cell() < n_unicode_to_koi8_25 )
		    *cursor++ = unicode_to_koi8_25[ch.cell()];
		else
		    *cursor++ = unkn;
	    } else if ( ch.row() == 0x04 ) {
		if ( ch.cell() < n_unicode_to_koi8_04 )
		    *cursor++ = unicode_to_koi8_04[ch.cell()];
		else
		    *cursor++ = unkn;
	    } else if ( ch.row() == 0x22 ) {
		if ( ch.cell() == 0x1A )
		    *cursor++ = 0x96;
		else if ( ch.cell() == 0x48 )
		    *cursor++ = 0x97;
		else if ( ch.cell() == 0x64 )
		    *cursor++ = 0x98;
		else if ( ch.cell() == 0x65 )
		    *cursor++ = 0x99;
		else
		    *cursor++ = unkn;
	    } else if ( ch.row() == 0x23 ) {
		if ( ch.cell() == 0x20 )
		    *cursor++ = 0x93;
		else if ( ch.cell() == 0x21 )
		    *cursor++ = 0x9B;
		else
		    *cursor++ = unkn;
	    } else if ( ch.row() == 0x20 ) {
		if ( ch.cell() == 0x22 )
		    *cursor++ = 0x95;
		else
		    *cursor++ = unkn;
	    } else {
		*cursor++ = unkn;
	    }
	} else {
	    if ( ch.cell() < 128 ) {
		*cursor++ = ch.cell();
	    } else {
		*cursor++ = unkn;
	    }
	}
    }
    *cursor = '\0';
    // len_in_out = cursor - result;
    return rstr;
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:57,代码来源:qkoi8codec.cpp

示例11: convertFromUnicode

/*!
    Converts the first \a len characters in \a uc from Unicode to this
    encoding, and returns the result in a byte array. The \a state contains
    some conversion flags, and is used by the codec to maintain state
    information.
*/
QByteArray QTsciiCodec::convertFromUnicode(const ushort *uc, int len, ConverterState *state)
{
    char replacement = '?';
    if (state) {
        if (state->flags & ConvertInvalidToNull)
            replacement = 0;
    }
    int invalid = 0;

    QByteArray rstr;
    rstr.resize(len);
    uchar* cursor = (uchar*)rstr.data();
    for (int i = 0; i < len; i++) {
        QChar ch = uc[i];
        uchar j;
        if (ch.row() == 0x00 && ch.cell() < 0x80) {
            // ASCII
            j = ch.cell();
        } else if ((j = qt_UnicodeToTSCII(uc[i],
                                          uc[i + 1],
                                          uc[i + 2]))) {
            // We have to check the combined chars first!
            i += 2;
        } else if ((j = qt_UnicodeToTSCII(uc[i],
                                          uc[i + 1], 0))) {
            i++;
        } else if ((j = qt_UnicodeToTSCII(uc[i], 0, 0))) {
        } else {
            // Error
            j = replacement;
            ++invalid;
        }
        *cursor++ = j;
    }
    rstr.resize(cursor - (const uchar*)rstr.constData());

    if (state) {
        state->invalidChars += invalid;
    }
    return rstr;
}
开发者ID:jackyglony,项目名称:DuiBrowser-1,代码行数:47,代码来源:qtsciicodec.cpp

示例12: if

static uint *dump( uint *p )
{
    while ( *p != END ) {
	if ( *p & CHR ) {
	    QChar uc = (QChar)*p;
	    char c = (char)uc;
	    uint u = (((uint)(uc.row())) << 8) | ((uint)uc.cell());
	    qDebug( "\tCHR\tU%04x (%c)", u, (c ? c : ' '));
	    p++;
	}
	else if ( *p & MCC ) {
	    uint clcode = *p & MCD;
	    uint numFields = *p & MVL;
	    if ( clcode == CCL )
		qDebug( "\tCCL\t%i", numFields );
	    else if ( clcode == CCN )
		qDebug( "\tCCN\t%i", numFields );
	    else
		qDebug("coding error!");
	    for ( int i = 0; i < (int)numFields; i++ ) {
		p++;
		if ( *p == PWS )
		    qDebug( "\t\tPWS" );
		else if ( *p == PDG )
		    qDebug( "\t\tPDG" );
		else {
		    uint from = ( *p & MCD ) >> 16;
		    uint to = *p & MVL;
		    char fc = (char)QChar(from);
		    char tc = (char)QChar(to);
		    qDebug( "\t\tU%04x (%c) - U%04x (%c)", from,
			   (fc ? fc : ' '), to, (tc ? tc : ' ') );
		}
	    }
	    p++;
	}
	else switch ( *p++ ) {
开发者ID:opieproject,项目名称:qte-opie,代码行数:37,代码来源:qregexp.cpp

示例13: return

bool QFontGb18030_0Codec::canEncode( QChar ch ) const
{
    //qDebug("QFontGb18030_0Codec::canEncode( QChar ch = %02X%02X )", ch.row(), ch.cell());
    return (ch.row () > 0 && !(ch.row () >= 0xd8 && ch.row () < 0xe0));
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:5,代码来源:qfontcncodec.cpp


注:本文中的QChar::row方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。