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


C++ QByteArray::constBegin方法代码示例

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


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

示例1: HandleImageData

	bool ServerObject::HandleImageData (Entity& e, const QVariantMap& hints)
	{
		const auto& dataVar = hints.value ("image-data", hints.value ("image_data"));
		if (dataVar.isNull ())
			return false;

		const auto& arg = dataVar.value<QDBusArgument> ();

		int width = 0, height = 0, rowstride = 0;
		bool hasAlpha = false;
		int bps = 0, channels = 0;
		QByteArray data;

		arg.beginStructure ();
		arg >> width >> height >> rowstride >> hasAlpha >> bps >> channels >> data;
		arg.endStructure ();

		const QImage img (reinterpret_cast<const uchar*> (data.constBegin ()),
				width, height, QImage::Format_ARGB32);
		if (img.isNull ())
			return false;

		e.Additional_ ["NotificationPixmap"] = QPixmap::fromImage (img.rgbSwapped ());
		return true;
	}
开发者ID:SboichakovDmitriy,项目名称:leechcraft,代码行数:25,代码来源:serverobject.cpp

示例2: reverse

QByteArray QCSP::reverse( const QByteArray &data ) const
{
	QByteArray reverse;
	for( QByteArray::const_iterator i = data.constEnd(); i != data.constBegin(); )
	{
		--i;
		reverse += *i;
	}
	return reverse;
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:10,代码来源:QCSP.cpp

示例3: loadRom

void CPU::loadRom(const std::string& h, const std::string& g, const std::string& f, const std::string& e)
{
    QFile file_h(QString::fromStdString(h));
    if(!file_h.open(QIODevice::ReadOnly))
    {
        error("Cannot open rom 1 : " + file_h.errorString().toStdString() + " : " +
              std::to_string(file_h.error()));
    }
    QFile file_g(QString::fromStdString(g));
    if(!file_g.open(QIODevice::ReadOnly))
    {
        error("Cannot open rom 2 : " + file_g.errorString().toStdString() + " : " +
              std::to_string(file_h.error()));
    }
    QFile file_f(QString::fromStdString(f));
    if(!file_f.open(QIODevice::ReadOnly))
    {
        error("Cannot open rom 3 : " + file_f.errorString().toStdString() + " : " +
              std::to_string(file_h.error()));
    }
    QFile file_e(QString::fromStdString(e));
    if(!file_e.open(QIODevice::ReadOnly))
    {
        error("Cannot open rom 4 : " + file_e.errorString().toStdString() + " : " +
              std::to_string(file_h.error()));
    }
    QByteArray hContents = file_h.readAll();
    std::copy(hContents.constBegin(), hContents.constEnd(),
              m_state.mem.begin());
    QByteArray gContents = file_g.readAll();
    std::copy(gContents.constBegin(), gContents.constEnd(),
              m_state.mem.begin() + 0x800);
    QByteArray fContents = file_f.readAll();
    std::copy(fContents.constBegin(), fContents.constEnd(),
              m_state.mem.begin() + 0x1000);
    QByteArray eContents = file_e.readAll();
    std::copy(eContents.constBegin(), eContents.constEnd(),
              m_state.mem.begin() + 0x1800);
}
开发者ID:Stellaris-code,项目名称:SpaceInvadersEmu,代码行数:39,代码来源:cpu.cpp

示例4: decrypt

QByteArray QCSP::decrypt( const QByteArray &data )
{
	HCRYPTKEY key = 0;
	if( !CryptGetUserKey( d->h, AT_KEYEXCHANGE, &key ) )
		return QByteArray();

	QByteArray reverse;
	for( QByteArray::const_iterator i = data.constEnd(); i != data.constBegin(); )
	{
		--i;
		reverse += *i;
	}
	DWORD size = reverse.size();
	bool result = CryptDecrypt( key, 0, true, 0, (BYTE*)reverse.data(), &size );
	CryptDestroyKey( key );

	return result ? reverse : QByteArray();
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:18,代码来源:QCSP.cpp

示例5: parsePoints

static QList<QPointF> parsePoints(const QByteArray &line)
{
    QList<QPointF> res;

    QByteArray::const_iterator it = line.constBegin();
    if (*it == ',')
        ++it;
    
    QList<qreal> nums = parseNumbersList(it);
    QList<qreal>::const_iterator nitr;
    for (nitr = nums.begin(); nitr != nums.end(); ++nitr) {
        qreal x = *nitr; ++nitr;
        Q_ASSERT(nitr != nums.end());
        qreal y = *nitr;
        res.append(QPointF(x, y));
    }

    return res;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:19,代码来源:dataparser.cpp

示例6: sign

QByteArray QCSP::sign( int method, const QByteArray &digest )
{
	ALG_ID alg = 0;
	switch( method )
	{
	case NID_sha1: alg = CALG_SHA1; break;
	case NID_sha256: alg = CALG_SHA_256; break;
	case NID_sha384: alg = CALG_SHA_384; break;
	case NID_sha512: alg = CALG_SHA_512; break;
	case NID_sha224:
	default: return QByteArray();
	}

	HCRYPTHASH hash = 0;
	if( !CryptCreateHash( d->h, alg, 0, 0, &hash ) )
		return QByteArray();

	if( !CryptSetHashParam( hash, HP_HASHVAL, (BYTE*)digest.constData(), 0 ) )
	{
		CryptDestroyHash( hash );
		return QByteArray();
	}

	DWORD size = 256;
	QByteArray sig;
	sig.resize( size );
	if( !CryptSignHashW( hash, AT_SIGNATURE, 0, 0, (BYTE*)sig.data(), &size ) )
		sig.clear();
	CryptDestroyHash( hash );

	QByteArray reverse;
	for( QByteArray::const_iterator i = sig.constEnd(); i != sig.constBegin(); )
	{
		--i;
		reverse += *i;
	}

	return reverse;
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:39,代码来源:QCSP.cpp

示例7: encodeURL

QString CGI::encodeURL(const QString &rawText)
{
    QByteArray utf = rawText.toUtf8();
    QString enc;
    enc.reserve(utf.length()); // Make sure we at least have space for a normal US-ASCII URL

    QByteArray::const_iterator it = utf.constBegin();
    while (it != utf.constEnd()) {
        const char ch = *it;
        if (('A' <= ch && ch <= 'Z')
            || ('a' <= ch && ch <= 'z')
            || ('0' <= ch && ch <= '9')) {
            enc.append(QLatin1Char(ch));
        } else if (ch == ' ') {
            enc.append(QLatin1Char('+'));
        } else {
            switch (ch) {
            case '-': case '_':
            case '(': case ')':
            case '.': case '!':
            case '~': case '*':
            case '\'':
                enc.append(QLatin1Char(ch));
                break;
            default:
                ushort c1 = (*it & 0xF0) >> 4;
                ushort c2 = (*it & 0x0F);
                enc.append(QLatin1Char('%'));
                enc.append(QLatin1Char(*(cgi_chars + c1)));
                enc.append(QLatin1Char(*(cgi_chars + c2)));
                break;
            }
        }
        ++it;
    }
    return enc;
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:37,代码来源:cgi.cpp

示例8: if


//.........这里部分代码省略.........
                        continue;
                    }

                    else if (fast_name == "__TIME__")
                    {
                        __result->append('"');
                        __result->append(QTime::currentTime().toString().toUtf8());
                        __result->append('"');
                        continue;
                    }

                }

                __result->append(name_begin, name_end - name_begin);
                continue;
            }

            if (! macro->isFunctionLike())
            {
                Macro *m = 0;

                if (! macro->definition().isEmpty())
                {
                    macro->setHidden(true);

                    QByteArray __tmp;
                    __tmp.reserve (256);

                    MacroExpander expand_macro (env);
                    expand_macro(macro->definition(), &__tmp);

                    if (! __tmp.isEmpty ())
                    {
                        const char *__tmp_begin = __tmp.constBegin();
                        const char *__tmp_end = __tmp.constEnd();
                        const char *__begin_id = skip_whitespaces (__tmp_begin, __tmp_end);
                        const char *__end_id = skip_identifier (__begin_id, __tmp_end);

                        if (__end_id == __tmp_end)
                        {
                            const QByteArray __id (__begin_id, __end_id - __begin_id);
                            m = env->resolve (__id);
                        }

                        if (! m)
                            *__result += __tmp;
                    }

                    macro->setHidden(false);
                }

                if (! m)
                    continue;

                macro = m;
            }

            // function like macro
            const char *arg_it = skip_whitespaces (__first, __last);

            if (arg_it == __last || *arg_it != '(')
            {
                __result->append(name_begin, name_end - name_begin);
                lines += skip_whitespaces.lines;
                __first = arg_it;
                continue;
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:67,代码来源:pp-macro-expander.cpp


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