本文整理汇总了C++中quint16函数的典型用法代码示例。如果您正苦于以下问题:C++ quint16函数的具体用法?C++ quint16怎么用?C++ quint16使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quint16函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:algogr,项目名称:Elina_Scanner,代码行数:13,代码来源:profortosi_progress_1_1.cpp
示例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);
}
开发者ID:MarioCode,项目名称:2048,代码行数:13,代码来源:board_2048.cpp
示例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);
}
开发者ID:zweecn,项目名称:Bowling,代码行数:13,代码来源:front_tcpserver.cpp
示例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();
}
开发者ID:pLiuYang,项目名称:CS3249-bus-management-system,代码行数:13,代码来源:TripPlanner.cpp
示例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");
}
开发者ID:mickelfeng,项目名称:Threaded-Client-Server-Application,代码行数:13,代码来源:client.cpp
示例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);
}
开发者ID:18062562566,项目名称:libQtShadowsocks,代码行数:14,代码来源:profile.t.cpp
示例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());
}
开发者ID:RS102839,项目名称:qt,代码行数:27,代码来源:tst_qabstractsocket.cpp
示例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();
}
开发者ID:SunInJuly,项目名称:SeaBattle,代码行数:14,代码来源:playerSocket.cpp
示例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);
}
开发者ID:atay,项目名称:madvnc,代码行数:15,代码来源:MadNet.cpp
示例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);
}
开发者ID:bigpotato911,项目名称:Qt-Talk-Client,代码行数:16,代码来源:logindialog.cpp
示例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("");
}
开发者ID:numiareced,项目名称:battleships,代码行数:15,代码来源:client.cpp
示例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();
}
开发者ID:Evtushenko,项目名称:HW_144,代码行数:15,代码来源:server.cpp
示例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;
}
开发者ID:Horsmir,项目名称:hstest,代码行数:27,代码来源:testmanager.cpp
示例14: quint16
void ProjectorShutterBlock::resetConnection() {
m_tcpSocket->abort();
m_tcpSocket->connectToHost(m_ipAddress, quint16(m_port));
m_projectorName = "";
m_powerStatus = 0;
m_passwordIsWrong = false;
}
开发者ID:ElectronicTheatreControlsLabs,项目名称:LuminosusEosEdition,代码行数:7,代码来源:ProjectorShutterBlock.cpp
示例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;
}
开发者ID:Rambo2015,项目名称:Drawpile,代码行数:27,代码来源:writer.cpp
示例16: QHostAddress
//SLOTS:
void ConnectionWidget::connectToRobot()
{
//Connect Code HERE
QHostAddress address = QHostAddress(robotName);
quint16 port = quint16(8533);
udpSocket->bind(QHostAddress::Any, port);
const char* data = "1";
if(udpSocket->writeDatagram (data, 1, address, port) == -1)
{
statusNetworkLabel->setText("Disconnect Error: Unable to send packet.");
disconnectButton->setEnabled(false);
connectButton->setEnabled(true);
}
else
{
QString text = QString("Connected to: ");
text.append(robotName);
statusNetworkLabel->setText(text);
disconnectButton->setEnabled(true);
connectButton->setEnabled(false);
}
}
开发者ID:BuddenD,项目名称:robocup,代码行数:26,代码来源:connectionwidget.cpp
示例17: out
void ClientCore::sendBlock(quint8 command, QByteArray *data)
{
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out << quint16(0);
out << command;
if (data!=NULL){
block.append(*data);
}
out.device()->seek(0);
out << quint16(block.size() - sizeof(quint16));
mainSocket->write(block);
}
开发者ID:Shikyaro,项目名称:uStorage,代码行数:16,代码来源:clientcore.cpp
示例18: if
void OS2LPlugin::setParameter(quint32 universe, quint32 line, Capability type,
QString name, QVariant value)
{
/** This method is provided to QLC+ to set the plugin specific settings.
* Those settings are saved in a project workspace and when it is loaded,
* this method is called after QLC+ has opened the input/output lines
* mapped in the project workspace as well.
*/
if (name == OS2L_HOST_ADDRESS)
{
}
else if (name == OS2L_HOST_PORT)
{
if (value.toInt() != m_hostPort)
{
m_hostPort = quint16(value.toUInt());
/** restart the TCP server and listen on new port */
enableTCPServer(false);
enableTCPServer(true);
}
}
/** Remember to call the base QLCIOPlugin method to actually inform
* QLC+ to store the parameter in the project workspace XML */
QLCIOPlugin::setParameter(universe, line, type, name, value);
}
开发者ID:mcallegari,项目名称:qlcplus,代码行数:29,代码来源:os2lplugin.cpp
示例19: main
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
app.addLibraryPath(app.applicationDirPath() + "/lib");
QCommandLineParser parser;
QList<QCommandLineOption> optionList;
optionList.append({{"d", "debug"}, "Log debug messages."});
optionList.append({{"c", "console"}, "Output log to the console."});
optionList.append({{"p", "port"}, "Application connection port.", "port", "1067"});
optionList.append({"database", "The name of the database file.", "database", "softphoneDatabase.db3"});
parser.addOptions(optionList);
parser.process(app);
bool debugOutput = parser.isSet("debug");
Logger::getInstance().enableDebugOutput(debugOutput);
bool consoleOutput = parser.isSet("console");
Logger::getInstance().enableConsoleOutput(consoleOutput);
SpThreadServer *server = new SpThreadServer();
server->setPort(quint16(parser.value("port").toInt()));
server->setDatabasePath(parser.value("database"));
server->start();
app.exec();
server->deleteLater();
}
开发者ID:Yurter,项目名称:SoftphoneServer,代码行数:28,代码来源:main.cpp
示例20: p
void Profile_T::testConstructorURI()
{
// ss://bf-cfb-auth:[email protected]:8888
QSS::Profile p("ss://YmYtY2ZiLWF1dGg6dGVzdEAxOTIuMTY4LjEwMC4xOjg4ODg#Tést");
QCOMPARE(QString("Tést"), p.nameTag);
QCOMPARE(QString("192.168.100.1"), p.server);
QCOMPARE(QString("127.0.0.1"), p.local_address);
QCOMPARE(QString("bf-cfb"), p.method);
QCOMPARE(QString("test"), p.password);
QCOMPARE(quint16(8888), p.server_port);
QCOMPARE(quint16(1080), p.local_port);
QCOMPARE(600, p.timeout);
QVERIFY(p.auth);
QVERIFY(!p.debug);
QVERIFY(!p.http_proxy);
}
开发者ID:18062562566,项目名称:libQtShadowsocks,代码行数:16,代码来源:profile.t.cpp
注:本文中的quint16函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论