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


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

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


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

示例1: digest

QByteArray Dialog::digest(const QString s)
{
    QByteArray c = s.toLatin1();
    int index;

    index = 0;

    while ((index = c.indexOf("\\n", index)) != -1) {
        c.replace(index, 2, "\n");
        index += 1;
    }

    index = 0;

    while ((index = c.indexOf("\\t", index)) != -1) {
        c.replace(index, 2, "\t");
        index += 1;
    }

    index = 0;

    while ((index = c.indexOf("\r", index)) != -1) {
        c.remove(index, 1);
    }

    return c;
}
开发者ID:DoUML,项目名称:douml,代码行数:27,代码来源:Dialog.cpp

示例2: handleReceivedForwardedAnnounce

void Dispatcher::handleReceivedForwardedAnnounce(QByteArray &datagram)
{
    QByteArray tmp = datagram.mid(2, 4);
    QHostAddress announcingHost(getQuint32FromByteArray(&tmp));
    datagram.remove(2, 4);
    handleReceivedAnnounce(UnicastPacket, announcingHost, datagram);
}
开发者ID:BackupGGCode,项目名称:arpmanetdc,代码行数:7,代码来源:dispatcher.cpp

示例3: destroy

/**
 *   Destroys tweet with id
 *   @param id tweet ID
 *   @param trimUser trims users info
 *   @param includeEntities true to include node entities in response
 */
void QTweetStatusDestroy::destroy(qint64 id,
                                  bool trimUser)
{
    if (!isAuthenticationEnabled()) {
        qCritical("Needs authentication to be enabled");
        return;
    }

    QUrl url("https://api.twitter.com/1.1/statuses/destroy.json");

    QUrl urlQuery(url);

    urlQuery.addQueryItem("id", QString::number(id));

    if (trimUser)
        urlQuery.addQueryItem("trim_user", "true");

    QNetworkRequest req(url);

    QByteArray oauthHeader = oauthTwitter()->generateAuthorizationHeader(urlQuery, OAuth::POST);
    req.setRawHeader(AUTH_HEADER, oauthHeader);
    req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

    QByteArray postBody = urlQuery.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemovePath);
    postBody.remove(0, 1);

    QNetworkReply *reply = oauthTwitter()->networkAccessManager()->post(req, postBody);
    connect(reply, SIGNAL(finished()), this, SLOT(reply()));
}
开发者ID:mattste,项目名称:QTweetLib,代码行数:35,代码来源:qtweetstatusdestroy.cpp

示例4: handleReceivedCIDPingForwardRequest

// forward the CID ping to own bucket on request
void Dispatcher::handleReceivedCIDPingForwardRequest(QHostAddress &fromAddr, QByteArray &data)
{
    data.remove(0, 2);
    QByteArray tmp = data.mid(0, 4);
    QHostAddress allegedFromHost = QHostAddress(getQuint32FromByteArray(&tmp));
    if (fromAddr != allegedFromHost)
        return;

    QByteArray datagram;
    datagram.reserve(30);
    switch(networkBootstrap->getBootstrapStatus())
    {
    case NETWORK_MCAST:
        datagram.append(MulticastPacket);
        datagram.append(CIDPingForwardedPacket);
        datagram.append(data);
        sendMulticastRawDatagram(datagram);
        break;
    case NETWORK_BCAST:
        datagram.append(BroadcastPacket);
        datagram.append(CIDPingForwardedPacket);
        datagram.append(data);
        sendBroadcastRawDatagram(datagram);
        break;
    }
}
开发者ID:BackupGGCode,项目名称:arpmanetdc,代码行数:27,代码来源:dispatcher.cpp

示例5: setFiffData

void BabyMEG::setFiffData(QByteArray DATA)
{
    //get the first byte -- the data format
    int dformat = DATA.left(1).toInt();

    DATA.remove(0,1);
    qint32 rows = m_pFiffInfo->nchan;
    qint32 cols = (DATA.size()/dformat)/rows;

    qDebug() << "[BabyMEG] Matrix " << rows << "x" << cols << " [Data bytes:" << dformat << "]";

    MatrixXf rawData(Map<MatrixXf>( (float*)DATA.data(),rows, cols ));

    for(qint32 i = 0; i < rows*cols; ++i)
        IOUtils::swap_floatp(rawData.data()+i);


    if(m_bIsRunning)
    {
        if(!m_pRawMatrixBuffer)
            m_pRawMatrixBuffer = CircularMatrixBuffer<float>::SPtr(new CircularMatrixBuffer<float>(40, rows, cols));

        m_pRawMatrixBuffer->push(&rawData);
    }
//    else
//    {
////        std::cout << "Data coming" << std::endl; //"first ten elements \n" << rawData.block(0,0,1,10) << std::endl;

//        emit DataToSquidCtrlGUI(rawData);
//    }

    emit DataToSquidCtrlGUI(rawData);
}
开发者ID:gitter-badger,项目名称:mne-cpp,代码行数:33,代码来源:babymeg.cpp

示例6: resetSession

void SessionStore::resetSession(HttpServerRequest &request) const
{
    // init variables
    QList<QByteArray> headers(request.headers().values("Cookie"));
    QByteArray newValue;

    // remove old cookies
    request.headers().remove("Cookie");

    // find cookies that don't match this store's settings
    for (int i = 0;i != headers.size();++i) {
        QList<QNetworkCookie> cookies(QNetworkCookie::parseCookies(headers[i]));

        for (int i = 0;i != cookies.size();++i) {
            if (cookies[i].name() != settings.name) {
                newValue
                    += cookies[i].toRawForm(QNetworkCookie::NameAndValueOnly)
                    + "; ";
            }
        }
    }

    if (!newValue.isEmpty()) {
        // removes the final "; "
        newValue.remove(newValue.size() - 2, 2);
    }

    // update the request headers
    request.headers().insert("Cookie", newValue);
}
开发者ID:ConfusedReality,项目名称:pkg_webserver_tufao,代码行数:30,代码来源:sessionstore.cpp

示例7: sendCoins

void Networking::sendCoins(QString address, QString amount)
{
    QString sendRequest;
    sendRequest = QString("https://www.instawallet.org/api/v1/w/%1/payment").arg(walletId);

    updating = true;

    QByteArray data;
    QUrl parameters;

    double convertedAmount;

    long long convertedLongAmount;

    QString stringAmount;

    convertedAmount = amount.toDouble();
    convertedLongAmount = convertedAmount * 1e8 + (convertedAmount < 0.0 ? -.5 : .5);

    stringAmount = QString("%1").arg(convertedLongAmount);

    qDebug("Amount converted to Satoshis: " + stringAmount.toAscii());

    parameters.addQueryItem("address", address);
    parameters.addQueryItem("amount", stringAmount);
    data.append(parameters.toString());
    data.remove(0, 1);

    networkPaymentManager->post(QNetworkRequest(QUrl(sendRequest)), data)->ignoreSslErrors();

    connect(networkPaymentManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(walletPaymentLoaded(QNetworkReply*)));
}
开发者ID:Matoking,项目名称:cuteCoin,代码行数:32,代码来源:Networking.cpp

示例8: openEmail

void UrlOpener::openEmail(const QByteArray &email)
{
	QString client;
	bool useDefaultEMailClient = config_file.readBoolEntry("Chat", "UseDefaultEMailClient", true);
	if (useDefaultEMailClient)
		client = config_file.readEntry("Chat", "MailClient");

	QByteArray urlForDesktopServices;
	QByteArray urlForApplication;
	if (email.startsWith("mailto:"))
	{
		urlForDesktopServices = email;
		urlForApplication = email;
		urlForApplication.remove(0, 7);
	}
	else
	{
		urlForDesktopServices = "mailto:" + email;
		urlForApplication = email;
	}

	if (!openUrl(urlForDesktopServices, urlForApplication, client))
		MessageDialog::show("dialog-error", qApp->translate("@default", QT_TR_NOOP("Kadu")),
				qApp->translate("@default", QT_TR_NOOP("Could not spawn Mail client process. Check if the Mail client is functional")));
}
开发者ID:partition,项目名称:kadu,代码行数:25,代码来源:url-opener.cpp

示例9: onSongReplyReceived

void LyricWikiPlugin::onSongReplyReceived()
{
    QByteArray data = reply->readAll();
    reply->deleteLater();

    // <div class='lyricbox'>(...)<script>(...)</script>(lyrics)<!--
    int i = data.indexOf("<div class='lyricbox'>");
    if (i != -1) {
        i += 22;
        data.remove(data.indexOf("<!--", i), data.length());

        if (data.indexOf("Category:Instrumental", i) != -1) {
            emit error("According to LyricWiki this track is instrumental.");
            return;
        }

        QTextDocument lyrics; lyrics.setHtml(data.mid(data.indexOf("</script>", i) + 9));
        QString plainLyrics = lyrics.toPlainText();

        if (plainLyrics.contains("we are not licensed to display the full lyrics for this song")) {
            emit error("The lyrics for this song are incomplete on LyricWiki.");
        } else {
            emit fetched(plainLyrics);
        }
    } else {
        emit error("The lyrics for this song are missing on LyricWiki.");
    }
}
开发者ID:Rusto,项目名称:openmediaplayer,代码行数:28,代码来源:lyricwikiplugin.cpp

示例10: SendToClientFirst

void HWMap::SendToClientFirst()
{
    SendIPC(QString("eseed %1").arg(m_seed).toUtf8());
    SendIPC(QString("e$template_filter %1").arg(templateFilter).toUtf8());
    SendIPC(QString("e$mapgen %1").arg(m_mapgen).toUtf8());
    if (!m_script.isEmpty())
    {
        SendIPC(QString("escript Scripts/Multiplayer/%1.lua").arg(m_script).toUtf8());
    }

    switch (m_mapgen)
    {
        case MAPGEN_MAZE:
            SendIPC(QString("e$maze_size %1").arg(m_maze_size).toUtf8());
            break;

        case MAPGEN_DRAWN:
        {
            QByteArray data = m_drawMapData;
            while(data.size() > 0)
            {
                QByteArray tmp = data;
                tmp.truncate(200);
                SendIPC("edraw " + tmp);
                data.remove(0, 200);
            }
            break;
        }
        default:
            ;
    }

    SendIPC("!");
}
开发者ID:GhostAlgorithm,项目名称:hw,代码行数:34,代码来源:hwmap.cpp

示例11: sendData

void BoxitSocket::sendData(quint16 msgID, QByteArray data) {
    // Send data in multiple data packages, if data is too big...
    while (true) {
        QByteArray subData = data.mid(0, BOXIT_SOCKET_MAX_SIZE);
        data.remove(0, BOXIT_SOCKET_MAX_SIZE);

        quint16 subMsgID = msgID;
        if (!data.isEmpty())
            subMsgID = MSG_DATA_PACKAGE_MULTIPLE;

        // Send data
        QByteArray block;
        QDataStream out(&block, QIODevice::WriteOnly);
        out.setVersion(QDataStream::Qt_4_6);
        out << (quint16)0;
        out << (quint16)subMsgID;
        out << subData;
        out.device()->seek(0);
        out << (quint16)(block.size() - 2*sizeof(quint16));

        write(block);
        flush();

        waitForBytesWritten(2000);

        if (data.isEmpty())
            break;
    }
}
开发者ID:fatman2021,项目名称:boxit,代码行数:29,代码来源:boxitsocket.cpp

示例12: getPacket

QByteArray Parser::getPacket(QByteArray& ta){
    const char etx = 0x03;
    int n = ta.indexOf(etx);
    QByteArray ra = ta.left(n);
    ta = ta.remove(0,n+1);
    return ra;
}
开发者ID:ndtmike,项目名称:Reboundlinx,代码行数:7,代码来源:parser.cpp

示例13: shortenTemplates

QByteArray shortenTemplates(const QByteArray& identifier)
{
    QByteArray ret = identifier;
    Q_ASSERT(KSharedConfig::openConfig());
    KConfigGroup conf = KSharedConfig::openConfig()->group(QLatin1String("Settings"));
    if (conf.readEntry(QLatin1String("shortenTemplates"), false)) {
        // remove template arguments between <...>
        int depth = 0;
        int open = 0;
        for (int i = 0; i < ret.length(); ++i) {
            if (ret.at(i) == '<') {
                if (!depth) {
                    open = i;
                }
                ++depth;
            } else if (ret.at(i) == '>') {
                --depth;
                if (!depth) {
                    ret.remove(open + 1, i - open - 1);
                    i = open + 1;
                    open = 0;
                }
            }
        }
    }
    return ret;
}
开发者ID:KDE,项目名称:massif-visualizer,代码行数:27,代码来源:util.cpp

示例14: while

ImapMailbox *ImapPrivate::parseMessages (ImapMailbox *mailbox) {
    QByteArray response;

    while (true) {
        // Read Message
        response.clear();       
        do {
            if (response.size() > 0) {
                response.remove(response.lastIndexOf('}'), 
                                response.size() - response.lastIndexOf('{'));
            }
            response.append(readLine());
        } while (isMultiline(response));

        // Break if End Response Found.
        if (isResponseEnd(response))
            break;

        // Parse and Add Message to Mailbox
        ImapMessage *message = _imapParseMessage(response.trimmed());
        if (message != NULL) mailbox->addMessage(message);
    }
    
    return(mailbox);
}
开发者ID:vohulg,项目名称:newimapgui,代码行数:25,代码来源:imap.cpp

示例15: ipad

QByteArray ImapPrivate::hmacMd5 (const QString& username,
                                 const QString& password,
                                 const QString& serverResponse)
{
    QByteArray passwordBytes = password.toLatin1();
    QByteArray ipad(64, 0);
    QByteArray opad(64, 0);
    
    for (int i = 0; i < 64; ++i) {
        if (i < passwordBytes.size()) {
            ipad[i] = (quint8)(0x36 ^ passwordBytes[i]);
            opad[i] = (quint8)(0x5c ^ passwordBytes[i]);
        } else {
            ipad[i] = 0x36;
            opad[i] = 0x5c;
        }
    }

    QByteArray serverResponseBytes = serverResponse.toLatin1();
    while (serverResponseBytes[0] == '+' || serverResponseBytes[0] == ' ')
        serverResponseBytes.remove(0, 1);
        
    QCryptographicHash md5hash(QCryptographicHash::Md5);
    md5hash.addData(ipad);
    md5hash.addData(serverResponseBytes);
    QByteArray resultIpad = md5hash.result();
    
    md5hash.reset();
    md5hash.addData(opad);
    md5hash.addData(resultIpad);
    QByteArray resultOpad = md5hash.result();
    
    QByteArray response = username.toLatin1() + ' ' + resultOpad.toHex();
    return(response.toBase64());
}
开发者ID:vohulg,项目名称:newimapgui,代码行数:35,代码来源:imap.cpp


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