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


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

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


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

示例1: decodeMetadataMessage

void MaxCube::decodeMetadataMessage(QByteArray data)
{
    QList<QByteArray> list = data.left(data.length()-2).split(',');
    QByteArray dataDecoded = QByteArray::fromBase64(list.at(2));
    qCDebug(dcEQ3) << "====================================================";
    qCDebug(dcEQ3) << "               METADATA message:";
    qCDebug(dcEQ3) << "====================================================";

    // parse room list
    int roomCount = dataDecoded.toHex().mid(4,2).toInt(0,16);

    QByteArray roomRawData = dataDecoded.toHex();
    roomRawData = roomRawData.right(roomRawData.length()-6);

    for(int i = 0; i < roomCount; i++){
        Room *room = new Room(this);
        room->setRoomId(roomRawData.left(2).toInt(0,16));
        int roomNameLength = roomRawData.mid(2,2).toInt(0,16);
        room->setRoomName(QByteArray::fromHex(roomRawData.mid(4,roomNameLength*2)));
        room->setGroupRfAddress(roomRawData.mid(roomNameLength*2 + 4, 6));
        m_roomList.append(room);
        roomRawData = roomRawData.right(roomRawData.length() - ((roomNameLength*2) + 10));
    }
    qCDebug(dcEQ3) << "-------------------------|-------------------------";
    qCDebug(dcEQ3) << "found " << m_roomList.count() << "rooms";
    qCDebug(dcEQ3) << "-------------------------|-------------------------";

    foreach (Room *room, m_roomList) {
        qCDebug(dcEQ3) << "               Room Name | " << room->roomName();
        qCDebug(dcEQ3) << "                 Room ID | " << room->roomId();
        qCDebug(dcEQ3) << "        Group RF Address | " << room->groupRfAddress();
        qCDebug(dcEQ3) << "-------------------------|-------------------------";
    }
开发者ID:haklein,项目名称:guh,代码行数:33,代码来源:maxcube.cpp

示例2: processNewMessage

void HeadlessHubIntegration::processNewMessage(QByteArray message) {

	qDebug()  << "HeadlessHubIntegration::processNewMessage: message: " << message;

    bool notify = false;
    QString priority("");
    QString from("Test");
    QString title("");
    QString body("");

    do {
    	int index = message.indexOf('|');
		qDebug() << "HeadlessHubIntegration::processNewMessage: index: " << index << "\n";
    	if (index > 0) {
    		if (priority.size() == 0) {
    			priority = message.left(index);
    			message = message.right(message.size() - index - 1);

    			qDebug() << "HeadlessHubIntegration::processNewMessage: priority: " << priority << "\n";
    			qDebug() << "HeadlessHubIntegration::processNewMessage: message: " << message << "\n";

    		} else
    		if (title.size() == 0) {
    			title = message.left(index);
    			message = message.right(message.size() - index - 1);

    			qDebug() << "HeadlessHubIntegration::processNewMessage: title: " << title << "\n";
    			qDebug() << "HeadlessHubIntegration::processNewMessage: message: " << message << "\n";
    		}
    	} else {
    		if (body.size() == 0) {
    			body += message;

    			qDebug() << "HeadlessHubIntegration::processNewMessage: body: " << body << "\n";
    		}

    		message.clear();
    	}
    } while (message.size() > 0);

	//The first part of the push denotes the priority of the message
	switch (priority.toInt()) {
	case PushManager::Low:
		break;
	case PushManager::Medium:
		break;
	case PushManager::High:
		notify = true;
		break;
	default:
		break;
	}

    QVariantMap* itemMap = new QVariantMap();
    (*itemMap)["body"] = body;

    _itemCounter++;
    bool retVal = _testAccount->addHubItem(_testAccount->categoryId(), *itemMap, from, title, QDateTime::currentDateTime().toMSecsSinceEpoch(), QString::number(_itemCounter),"", "",  notify);
}
开发者ID:hendrik-dev,项目名称:Cascades-Community-Samples,代码行数:59,代码来源:HeadlessHubIntegration.cpp

示例3: getALine

char KGrGameIO::getALine (const bool kgr3, QByteArray & line)
{
    char c;
    line = "";
    while (openFile.getChar (&c)) {
        line = line.append (c);
        if (c == '\n') {
            break;
        }
    }

    // kDebug() << "Raw line:" << line;
    if (line.size() <= 0) {
        // Return a '\0' byte if end-of-file.
        return ('\0');
    }
    if (kgr3) {
        // In KGr 3 format, strip off leading and trailing syntax.
        if (line.startsWith ("// ")) {
            line = line.right (line.size() - 3);
            // kDebug() << "Stripped comment is:" << line;
        }
        else {
            if (line.startsWith (" i18n(\"")) {
                line = ' ' + line.right (line.size() - 7);
            }
            else if (line.startsWith (" NOTi18n(\"")) {
                line = ' ' + line.right (line.size() - 10);
            }
            else if (line.startsWith (" \"")) {
                line = ' ' + line.right (line.size() - 2);
            }
            if (line.endsWith ("\");\n")) {
                line = line.left (line.size() - 4) + '\n';
            }
            else if (line.endsWith ("\\n\"\n")) {
                line = line.left (line.size() - 4) + '\n';
            }
            else if (line.endsWith ("\"\n")) {
                line = line.left (line.size() - 2);
            }
            // kDebug() << "Stripped syntax is:" << line;
        }
        // In Kgr 3 format, return the first byte if not end-of-file.
        c = line.at (0);
        line = line.right (line.size() - 1);
        return (c);
    }
    else {
        // In KGr 2 format, return a space if not end-of-file.
        return (' ');
    }
}
开发者ID:jsj2008,项目名称:kdegames,代码行数:53,代码来源:kgrgameio.cpp

示例4: getFullSequence

//This function gets the node's sequence.  The full parameter only has an effect
//for Velvet LastGraph files where the sequences are shifted from their reverse
//complement.  If full is true and the graph is from Velvet, this function will
//extend the sequence using either the reverse complement or upstream nodes.
QByteArray DeBruijnNode::getFullSequence() const
{
    if (g_assemblyGraph->m_graphFileType != LAST_GRAPH)
        return getSequence();

    //If the code got here, then we are getting a full sequence from a Velvet
    //LastGraph graph, so we need to extend the beginning of the sequence.
    int extensionLength = g_assemblyGraph->m_kmer - 1;

    //If the node is at least k-1 in length, then the necessary sequence can be
    //deduced from the reverse complement node.
    if (getLength() >= extensionLength)
    {
        QByteArray revCompSeq = getReverseComplement()->getSequence();
        QByteArray endOfRevCompSeq = revCompSeq.right(extensionLength);
        QByteArray extension = AssemblyGraph::getReverseComplement(endOfRevCompSeq);
        return extension + getSequence();
    }

    //If the node is not long enough, then we must look in upstream nodes for
    //the rest of the sequence.
    else
    {
        QByteArray extension = getUpstreamSequence(extensionLength);
        if (extension.length() < extensionLength)
        {
            int additionalBases = extensionLength - extension.length();
            QByteArray n;
            n.fill('N', additionalBases);
            extension = n + extension;
        }
        return extension + getSequence();
    }
}
开发者ID:fxia22,项目名称:Bandage,代码行数:38,代码来源:debruijnnode.cpp

示例5: getUriFromUriRecordPayload

QString NdefFactory::getUriFromUriRecordPayload(const QByteArray &payload) {

	QString uri;

	qDebug() << "XXXX Uri - raw: " << payload.toHex();

	uchar_t uriType;
	int uriLength;

	uriType = payload[0];
	uriLength = payload.length() - 1;

	qDebug() << "XXXX UriType: " << uriType;
	qDebug() << "XXXX UriLength: " << uriLength;

	uri = QString::fromUtf8(payload.right(uriLength).constData(), uriLength);

	if (prefixMapContains(uriType)) {
		uri.prepend(prefixMapFromType(uriType));
	} else {
		qDebug() << QString("URI Prefix %1 not implemented").arg(uriType);
	}

	qDebug() << "XXXX Uri: " << uri;

	return uri;
}
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:27,代码来源:NdefFactory.cpp

示例6: LogMessageToConsle

RSUERRORCODE rsutransframe::TransB6(QFrame_B6 &rsuB6, const QByteArray message)
{
    int len;
    QFrame_B6Raw raw;

    len=message.length()-3;
    rsuB6.initQFrame_B6();

    if(len != sizeof(QFrame_B6Raw))
    {
        LogMessageToConsle(QObject::tr("B6帧数据的长度ERROR:QFrame_B6Raw:%1,QFrame_B6:%2")
                           .arg(sizeof(QFrame_B6Raw)).arg(len));
        return rsuLenghError;
    }
    else
    {
        memcpy(&raw,message.right(message.length()-2).data(),sizeof(QFrame_B6Raw));
    }

    if(raw.ErrorCode != 0x00)
    {
        LogMessageToConsle(QObject::tr("B6帧数据CodeError"));
        return rsuRecivedB6CodeError;
    }

    rsuB6.OBUID=Swapquint32(raw.OBUID);
    rsuB6.ErrorCode=raw.ErrorCode;
    memcpy(&rsuB6.FileData0ARaw, &raw.FileData0ARaw, sizeof(raw.FileData0ARaw));
    LogMessageToConsle(QObject::tr("B6帧数据解析:正确"));
    return rsuNoError;
}
开发者ID:eilin1208,项目名称:QT_Test,代码行数:31,代码来源:rsutransframe.cpp

示例7: f

void
setupLogfile()
{
    if ( QFileInfo( logFile().toLocal8Bit() ).size() > LOGFILE_SIZE )
    {
        QByteArray lc;
        {
            QFile f( logFile().toLocal8Bit() );
            f.open( QIODevice::ReadOnly | QIODevice::Text );
            lc = f.readAll();
            f.close();
        }

        QFile::remove( logFile().toLocal8Bit() );

        {
            QFile f( logFile().toLocal8Bit() );
            f.open( QIODevice::WriteOnly | QIODevice::Text );
            f.write( lc.right( LOGFILE_SIZE - ( LOGFILE_SIZE / 4 ) ) );
            f.close();
        }
    }

    logfile.open( logFile().toLocal8Bit(), ios::app );
    qInstallMsgHandler( TomahawkLogHandler );
}
开发者ID:demelziraptor,项目名称:tomahawk,代码行数:26,代码来源:Logger.cpp

示例8: bytesToColor

 // The following constants change the appearance of the identicon
 // they have been choosen by trying to make the output look nice.
 Identicon::Identicon(const QByteArray& data)
 {
   //  static_assert(Identicon::COLORS == 2, "Only two colors are implemented");
     // hash with sha256
     QByteArray hash = QCryptographicHash::hash(data, QCryptographicHash::Sha256);
     for (int colorIndex = 0; colorIndex < COLORS; ++colorIndex) {
         const QByteArray hashPart = hash.right(IDENTICON_COLOR_BYTES);
         hash.truncate(hash.length() - IDENTICON_COLOR_BYTES);
 
         const qreal hue = bytesToColor(hashPart);
         // change offset when COLORS != 2
         const qreal lig = static_cast<qreal>(colorIndex) / COLORS + 0.2;
         const qreal sat = 0.5;
         colors[colorIndex].setHslF(hue, sat, lig);
     }
 
     const uint8_t* const hashBytes = reinterpret_cast<const uint8_t*>(hash.constData());
     // compute the block colors from the hash
     for (int row = 0; row < IDENTICON_ROWS; ++row) {
         for (int col = 0; col < ACTIVE_COLS; ++col) {
             const int hashIdx = row * ACTIVE_COLS + col;
             const uint8_t colorIndex = hashBytes[hashIdx] % COLORS;
             identiconColors[row][col] = colorIndex;
         }
     }
 }
开发者ID:Crystal-Photonics,项目名称:crystalTestFrameworkApp,代码行数:28,代码来源:identicon.cpp

示例9: TagMessage

TagMessage
TagMessage::fromVarLengthMessage( const QByteArray & data )
{
    QString tag = data.constData();
    VarLengthMessage ba = data.right( data.size() - tag.size() - 1 );
    return TagMessage( tag, ba );
}
开发者ID:Astroua,项目名称:CARTAvis,代码行数:7,代码来源:TagMessage.cpp

示例10: decodeMessage

bool KeyStream::decodeMessage(QByteArray& buffer, int macOffset, int offset, int length)
{
    //qDebug() << "decodeMessage seq:" << seq;
    QByteArray base = buffer.left(buffer.size() - 4);
    QByteArray hmac = buffer.right(4);
    QByteArray buffer2 = processBuffer(base, seq++);
    buffer2 = mac->hmacSha1(buffer2);

    QByteArray origBuffer = buffer;
    buffer = base;
    rc4->Cipher(buffer.data(),0,buffer.size());

    for (int i = 0; i < 4; i++)
    {
        if (buffer2[macOffset + i] != hmac[i])
        {
            qDebug() << "error decoding message. macOffset:" << macOffset << "offset:" << offset << "length:" << length << "bufferSize:" << buffer.size();
            qDebug() << "buffer mac:" << buffer2.toHex() << "hmac:" << hmac.toHex();
            qDebug() << "buffer:" << buffer.toHex();
            qDebug() << "origBuffer:" << origBuffer.toHex();
            return false;
        }
    }
    return true;
}
开发者ID:0xaaa,项目名称:yappari,代码行数:25,代码来源:keystream.cpp

示例11: responderParseHalfKeyAndResponderIntegrity

void HandshakeResponder::responderParseHalfKeyAndResponderIntegrity(){ //R:2 parse
    m_timeout.stop();
    QByteArray encryptedSymKey;
    m_socketStream >> encryptedSymKey;
    if(isError(encryptedSymKey)) return;

    QByteArray clearSymKey = rsaDecrypt(encryptedSymKey);
    if(clearSymKey.size()<32){
        processError(BadSymmetricKey);
        return;
    }
    m_gcmKey.append(clearSymKey.left(16));      //second half key
    m_gcmBaseIV.append(clearSymKey.right(16));  //second half IV

    QByteArray encryptedRespIntegrity, responderIntegrity;
    m_socketStream >> encryptedRespIntegrity;
    responderIntegrity = gcmDecrypt(encryptedRespIntegrity);

    if(responderIntegrity != m_responderIntegrityHash){
        processError(DataCorrupted);
        return;
    }

    updateIntegrityHash(&m_starterIntegrityHash, clearSymKey+responderIntegrity);
    responderSendStarterIntegrity();
}
开发者ID:thomas-picariello,项目名称:SDTP,代码行数:26,代码来源:handshakeresponder.cpp

示例12: decrypt

QByteArray RSAKeyPair::decrypt(QByteArray cryptotext) {
    Q_D(RSAKeyPair);

    QByteArray output;

    int rsize = d->key.len;

    unsigned char *chunk = new unsigned char[rsize];

    for(; cryptotext.size() > 0; ) {
        int dlen = qMin<int>(rsize, cryptotext.size());

        int dec;

        rsa_pkcs1_decrypt(&d->key, RSA_PRIVATE, &dec, (unsigned char *) cryptotext.data(), chunk, dlen);

        output += QByteArray((char *) chunk, dec);

        cryptotext = cryptotext.right(cryptotext.size() - rsize);
    }

    delete chunk;

    return output;
}
开发者ID:whitequark,项目名称:sparkle,代码行数:25,代码来源:RSAKeyPair.cpp

示例13: OutputByteArray

QVariant QNearFieldTagType4Symbian::decodeResponse(const QByteArray &command, const QByteArray &response)
{
    BEGIN
    QVariant result;

    OutputByteArray(response);
    if ((command.count() > 2) && (0x00 == command.at(0)))
    {
        if ( (0xA4 == command.at(1)) || (0xD6 == command.at(1)) )
        {
            if (response.count() >= 2)
            {
                LOG("select or write command");
                QByteArray resp = response.right(2);
                result = ((resp.at(0) == 0x90) && (resp.at(1) == 0x00));
            }
        }
        else
        {
            LOG("read command");
            result = response;
        }
    }
    END
    return result;
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:26,代码来源:qnearfieldtagtype4_symbian.cpp

示例14: setupLogfile

void setupLogfile()
{
    if ( QFileInfo( LOGFILE ).size() > LOGFILE_SIZE )
    {
        QByteArray lc;
        {
            QFile f( LOGFILE );
            f.open( QIODevice::ReadOnly | QIODevice::Text );
            lc = f.readAll();
            f.close();
        }

        QFile::remove( LOGFILE );

        {
            QFile f( LOGFILE );
            f.open( QIODevice::WriteOnly | QIODevice::Text );
            f.write( lc.right( LOGFILE_SIZE - (LOGFILE_SIZE / 4) ) );
            f.close();
        }
    }

    logfile.open( LOGFILE, std::ios::app );
    qInstallMsgHandler( LogHandler );
}
开发者ID:lasconic,项目名称:tomahawk-resolvers,代码行数:25,代码来源:spotifyresolver.cpp

示例15: clean_my_name_lable

void UCHome_Main_SiteConst::clean_my_name_lable()
{
    //<my:name uid="1673222" />
    //<my:name uid="1673222"></my:name>

    //QString unis = this->codec->toUnicode(this->feed_page_html);
    //QByteArray u8s = this->u8codec->fromUnicode(unis);
    //unis = u8s;
    QByteArray tarr = this->feed_page_html;

    QRegExp exp1 ("<my:name uid=\"[0-9]{1,12}\" />");
    QRegExp exp2 ( "<my:name uid=\"[0-9]{1,12}\"></my:name>");
    
    tarr = tarr.trimmed();
    if(tarr.startsWith("f5b")) {
        tarr = tarr.right(tarr.length()-3);
    }
    if(tarr.endsWith("0")) {
        tarr = tarr.left(tarr.length()-1);
    }
    //unis = unis.replace(exp1, QString(""));
    //unis = unis.replace(exp2, QString(""));
    
    //u8s = this->u8codec->fromUnicode(unis);
    QString unis = this->codec->toUnicode(tarr);

    this->feed_page_utf8_html = this->u8codec->fromUnicode(unis);

    this->feed_page_utf8_html = this->u8codec->fromUnicode(this->codec->toUnicode(this->feed_page_html));
}
开发者ID:kitech,项目名称:snsnotify,代码行数:30,代码来源:uch_mydev_feed.cpp


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