本文整理汇总了C++中quint16函数的典型用法代码示例。如果您正苦于以下问题:C++ quint16函数的具体用法?C++ quint16怎么用?C++ quint16使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quint16函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: out
void profortosi_progress_1_1::requestproFortosi()
{
QByteArray block;
QDataStream out(&block,QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
QString req_type="PRE";
out << quint16(0)<<req_type<<QString(profortosi_id);
qDebug()<<"FORTOSI_ID"<<profortosi_id;
out.device()->seek(0);
out<<quint16(block.size()-sizeof(quint16));
client->write(block);
}
示例2: out
void board_2048::slotSendToServer()
{
QByteArray arrBlock;
QDataStream out(&arrBlock, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_5_4);
out << quint16(0) << ui->curScore->text() << ui->bestScore->text();
out.device()->seek(0);
out << quint16(arrBlock.size() - sizeof(quint16));
TcpSocket->write(arrBlock);
}
示例3: out
void FrontClientSocket::sentToClient(int tag)
{
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
out << quint16(0);
out << quint16(tag);
out.device()->seek(0);
out << quint16(block.size() - sizeof(quint16));
write(block);
}
示例4: out
void TripPlanner::sendRequest()
{
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
out << quint16(0) << quint8('B') << busID << busName;
out.device()->seek(0); // Go to beginning of block.
out << quint16(block.size() - sizeof(quint16));
this->write(block);
stopSearch();
}
示例5: out
void Client::sendLoginInfo(){
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
out << quint16(0) << quint8('L') << userLineEdit->text() << passLineEdit->text();
out.device()->seek(0);
out << quint16(block.size() - sizeof(quint16));
tcpSocket->write(block);
//ui.label->setText(tr("Sending request..."));
//printf("Sending Request...\n");
}
示例6: QVERIFY
void Profile_T::testConstructorEmpty()
{
QSS::Profile p;
QVERIFY(p.server.isEmpty());
QCOMPARE(QString("127.0.0.1"), p.local_address);
QVERIFY(p.method.isEmpty());
QVERIFY(p.password.isEmpty());
QCOMPARE(quint16(8388), p.server_port);
QCOMPARE(quint16(1080), p.local_port);
QCOMPARE(600, p.timeout);
QVERIFY(!p.auth);
QVERIFY(!p.debug);
QVERIFY(!p.http_proxy);
}
示例7: QCOMPARE
// Testing get/set functions
void tst_QAbstractSocket::getSetCheck()
{
MyAbstractSocket obj1;
// qint64 QAbstractSocket::readBufferSize()
// void QAbstractSocket::setReadBufferSize(qint64)
obj1.setReadBufferSize(qint64(0));
QCOMPARE(qint64(0), obj1.readBufferSize());
obj1.setReadBufferSize((Q_INT64_C(-9223372036854775807) - 1));
QCOMPARE((Q_INT64_C(-9223372036854775807) - 1), obj1.readBufferSize());
obj1.setReadBufferSize(Q_INT64_C(9223372036854775807));
QCOMPARE(Q_INT64_C(9223372036854775807), obj1.readBufferSize());
// quint16 QAbstractSocket::localPort()
// void QAbstractSocket::setLocalPort(quint16)
obj1.setLocalPort(quint16(0));
QCOMPARE(quint16(0), obj1.localPort());
obj1.setLocalPort(quint16(0xffff));
QCOMPARE(quint16(0xffff), obj1.localPort());
// quint16 QAbstractSocket::peerPort()
// void QAbstractSocket::setPeerPort(quint16)
obj1.setPeerPort(quint16(0));
QCOMPARE(quint16(0), obj1.peerPort());
obj1.setPeerPort(quint16(0xffff));
QCOMPARE(quint16(0xffff), obj1.peerPort());
}
示例8: request
void PlayerSocket::sendEnemyConnectionInf(const QSharedPointer<PlayerSocket>& enemy, bool serverFlag)
{
QByteArray bytes;
QDataStream request(&bytes, QIODevice::ReadWrite);
request.setVersion(Protocol::QDataStreamVersion);
request << quint16(0) << quint8(Protocol::GAME_FOUND) << serverFlag;
request << enemy->getServerPort() << enemy->getHostName().toLatin1().data();
request.device()->seek(0);
request << quint16(bytes.size());
socket->write(bytes);
socket->flush();
}
示例9: controlStream
void MadNet::sendKeyEvent(QKeyEvent * myEvent){
QByteArray controls;
QDataStream controlStream(&controls, QIODevice::ReadWrite);
controlStream.setVersion(QDataStream::Qt_4_1);
controlStream << quint16(0);
controlStream << quint64(myEvent->type())
<< quint64(myEvent->key())
<< quint64(myEvent->modifiers());
controlStream.device()->seek(0);
controlStream << quint16(controls.size() - sizeof(quint16));
socket.write(controls);
}
示例10: qDebug
//Write to the server to verify the user infomation
void LoginDialog::verify()
{
qDebug("Connected to server...");
ui->loginButton->setDisabled(true);
QByteArray block;
QDataStream out(&block,QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_7);
out << quint16(0) << QString("Verify") << m_userName.trimmed() << m_password.trimmed();
out.device()->seek(0);
out << quint16(block.size() - sizeof(quint16));
qDebug() << block.size();
client->write(block);
}
示例11: out
void Client::slotSendToServer()
{
QByteArray arrBlock;
QDataStream out(&arrBlock, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_2);
QString str = "message " + ui->m_ptxtInput->text();
out << quint16(0) <<QTime::currentTime() << str;
out.device()->seek(0);
out << quint16(arrBlock.size() - sizeof(quint16));
ui->m_ptxtInfo->append("you: " + ui->m_ptxtInput->text());
m_pTcpSocket->write(arrBlock);
ui->m_ptxtInput->setText("");
}
示例12: out
void Server::sendToClient(int number)
{
QByteArray arrBlock;
QDataStream out(&arrBlock, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_5_2);
out << quint16(0) << QString::number(number);
out.device()->seek(0);
out << quint16(arrBlock.size() - sizeof(quint16));
sender->write(arrBlock);
txtInfo->append("<b>You:</b>");
txtInfo->append(QString::number(number));
field->lockButtons();
}
示例13: getTest
bool TestManager::editTest(const QString &catName, const QString &testName, const quint32 numVis, const bool vis)
{
if(!tests->editTest(catName, testName, numVis, vis))
return false;
Test test = getTest(catName, testName);
test.setNumVis(numVis);
if(vis)
test.setVis();
else
test.setNoVis();
QString testFileName = tests->getFileNameTest(catName, testName);
QFile file(testsDir + "/" + testFileName);
if(!file.open(QIODevice::WriteOnly))
{
qDebug() << "Can not open file " << (testsDir + "/" + testFileName) << " for writing. Error: " << file.errorString();
return false;
}
QDataStream out(&file);
out << quint32(magicNumber) << quint16(out.version());
out << test;
return true;
}
示例14: quint16
void ProjectorShutterBlock::resetConnection() {
m_tcpSocket->abort();
m_tcpSocket->connectToHost(m_ipAddress, quint16(m_port));
m_projectorName = "";
m_powerStatus = 0;
m_passwordIsWrong = false;
}
示例15: Q_ASSERT
bool Writer::writeHeader()
{
Q_ASSERT(m_file->isOpen());
// Format identification
const char *MAGIC = "DPREC";
m_file->write(MAGIC, 6);
// Metadata block
QJsonObject metadata;
QJsonObject version;
version["major"] = DRAWPILE_PROTO_MAJOR_VERSION;
version["minor"] = DRAWPILE_PROTO_MINOR_VERSION;
version["str"] = DRAWPILE_VERSION;
metadata["version"] = version;
// Write metadata
QByteArray metadatabuf = QJsonDocument(metadata).toJson(QJsonDocument::Compact);
uchar lenbuf[2];
qToBigEndian(quint16(metadatabuf.length()), lenbuf);
m_file->write((const char*)lenbuf, 2);
m_file->write(metadatabuf);
return true;
}