mirror of
https://gitlab.com/eql/EQL5.git
synced 2025-12-07 02:50:59 -08:00
port of EQL/Qt4 to Qt5
This commit is contained in:
commit
0591f54ce8
339 changed files with 99935 additions and 0 deletions
31
examples/9-simple-lisp-editor/send/send.cpp
Normal file
31
examples/9-simple-lisp-editor/send/send.cpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include <QtCore>
|
||||
#include <QtNetwork>
|
||||
#include <QtDebug>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
QCoreApplication qapp(argc, argv);
|
||||
QLocalSocket socket;
|
||||
socket.connectToServer("EQL:local-server");
|
||||
socket.waitForConnected();
|
||||
qapp.processEvents();
|
||||
QString exp(QCoreApplication::arguments().at(1));
|
||||
if(socket.isWritable()) {
|
||||
QString data(QString::number(exp.size()) + " " + exp);
|
||||
socket.write(data.toLatin1());
|
||||
qapp.processEvents();
|
||||
socket.waitForBytesWritten();
|
||||
while(true) {
|
||||
socket.waitForReadyRead();
|
||||
qapp.processEvents();
|
||||
QString data(socket.readAll());
|
||||
QString type(data.section(' ', 1, 1));
|
||||
if(!(":EXPRESSION" == type)) {
|
||||
QString print(data.section(' ', 2).trimmed());
|
||||
if(!print.isEmpty()) {
|
||||
std::cout << qPrintable(print) << std::endl; }
|
||||
if(":VALUES" == type) {
|
||||
exit(0); }}}}
|
||||
qCritical() << "[send] error:" << exp;
|
||||
return -1; }
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue