本文整理汇总了C++中setOpenMode函数的典型用法代码示例。如果您正苦于以下问题:C++ setOpenMode函数的具体用法?C++ setOpenMode怎么用?C++ setOpenMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setOpenMode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setOpenMode
/*!
\fn Win_QextSerialPort& Win_QextSerialPort::operator=(const Win_QextSerialPort& s)
overrides the = operator
*/
Win_QextSerialPort& Win_QextSerialPort::operator=(const Win_QextSerialPort& s)
{
setOpenMode(s.openMode());
lastErr=s.lastErr;
port = s.port;
Settings.FlowControl=s.Settings.FlowControl;
Settings.Parity=s.Settings.Parity;
Settings.DataBits=s.Settings.DataBits;
Settings.StopBits=s.Settings.StopBits;
Settings.BaudRate=s.Settings.BaudRate;
Win_Handle=s.Win_Handle;
memcpy(&Win_CommTimeouts, &s.Win_CommTimeouts, sizeof(COMMTIMEOUTS));
return *this;
}
示例2: resetStatus
void Q3SocketDevice::close()
{
if ( fd == -1 || !isOpen() ) // already closed
return;
resetStatus();
setOpenMode(NotOpen);
::close( fd );
#if defined(QSOCKETDEVICE_DEBUG)
qDebug( "Q3SocketDevice::close: Closed socket %x", fd );
#endif
fd = -1;
fetchConnectionParameters();
QIODevice::close();
}
示例3: setOpenMode
bool ByteArrayModelIoDevice::open( OpenMode openMode )
{
QIODevice::open( openMode );
openMode ^= WriteOnly | Append;
setOpenMode( openMode );
if( ! isReadable() )
return false;
seek( 0 );
return true;
}
示例4: data
CustomDeviceReply::CustomDeviceReply(QByteArray &fileData)
: data(fileData), origLen(fileData.length())
{
qDebug() << "CustomDeviceReply::CustomDeviceReply() ";
setOpenMode(QIODevice::ReadOnly | QIODevice::Unbuffered);
//setOpenMode(QIODevice::Text);
//data = QString::fromStdString("div,html{background-color:red;}").toUtf8();
//emit readyRead();
QTimer::singleShot(0, this, &QIODevice::readyRead);
QTimer::singleShot(0, this, &QIODevice::readChannelFinished);
}
示例5: data
HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request,
const QByteArray &fileData, const QString& mimeType)
: data(fileData), origLen(fileData.length())
{
TRACE_OBJ
setRequest(request);
setUrl(request.url());
setOpenMode(QIODevice::ReadOnly);
setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen));
QTimer::singleShot(0, this, SIGNAL(metaDataChanged()));
QTimer::singleShot(0, this, SIGNAL(readyRead()));
QTimer::singleShot(0, this, SIGNAL(finished()));
}
示例6: QextSerialBase
/*!
\fn Win_QextSerialPort::Win_QextSerialPort(const Win_QextSerialPort&)
Copy constructor.
*/
Win_QextSerialPort::Win_QextSerialPort(const Win_QextSerialPort& s):
QextSerialBase(s.port)
{
Win_Handle=INVALID_HANDLE_VALUE;
setOpenMode(s.openMode());
lastErr=s.lastErr;
port = s.port;
Settings.FlowControl=s.Settings.FlowControl;
Settings.Parity=s.Settings.Parity;
Settings.DataBits=s.Settings.DataBits;
Settings.StopBits=s.Settings.StopBits;
Settings.BaudRate=s.Settings.BaudRate;
Win_Handle=s.Win_Handle;
memcpy(&Win_CommTimeouts, &s.Win_CommTimeouts, sizeof(COMMTIMEOUTS));
}
示例7: flush
void CryptFileDevice::close()
{
if (!isOpen())
return;
if ((openMode() & WriteOnly) || (openMode() & Append))
flush();
seek(0);
m_device->close();
setOpenMode(NotOpen);
if (m_encrypted)
m_encrypted = false;
}
示例8: setRequest
KCHMNetworkReply::KCHMNetworkReply( const QNetworkRequest &request, const QUrl &url )
{
setRequest( request );
setOpenMode( QIODevice::ReadOnly );
m_data = loadResource( url );
m_length = m_data.length();
setHeader( QNetworkRequest::ContentLengthHeader, QByteArray::number(m_data.length()) );
QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);
if ( m_length )
QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
}
示例9: Q_D
void QBluetoothSocket::abort()
{
if (state() == UnconnectedState)
return;
Q_D(QBluetoothSocket);
setOpenMode(QIODevice::NotOpen);
setSocketState(ClosingState);
d->abort();
#ifndef QT_ANDROID_BLUETOOTH
//Android closes when the Java event loop comes around
setSocketState(QBluetoothSocket::UnconnectedState);
emit disconnected();
#endif
}
示例10: fileName
/*!
\reimp
Creates a unique file name for the temporary file, and opens it. You can
get the unique name later by calling fileName(). The file is guaranteed to
have been created by this function (i.e., it has never existed before).
*/
bool QTemporaryFile::open(OpenMode flags)
{
Q_D(QTemporaryFile);
if (!d->fileName.isEmpty()) {
if (static_cast<QTemporaryFileEngine*>(d->engine())->isReallyOpen()) {
setOpenMode(flags);
return true;
}
}
if (QFile::open(flags)) {
d->fileName = d->fileEngine->fileName(QAbstractFileEngine::DefaultName);
return true;
}
return false;
}
示例11: LOCK_MUTEX
/*!
\fn bool Posix_QextSerialPort::open(OpenMode mode)
Opens the serial port associated to this class.
This function has no effect if the port associated with the class is already open.
The port is also configured to the current settings, as stored in the Settings structure.
*/
bool Posix_QextSerialPort::open(OpenMode mode)
{
LOCK_MUTEX();
if (mode == QIODevice::NotOpen)
return isOpen();
if (!isOpen()) {
/*open the port*/
qDebug("trying to open file");
//note: linux 2.6.21 seems to ignore O_NDELAY flag
if ((fd = ::open(port.toAscii() ,O_RDWR | O_NOCTTY | O_NDELAY)) != -1) {
qDebug("file opened succesfully");
setOpenMode(mode); // Flag the port as opened
tcgetattr(fd, &old_termios); // Save the old termios
Posix_CommConfig = old_termios; // Make a working copy
cfmakeraw(&Posix_CommConfig); // Enable raw access
/*set up other port settings*/
Posix_CommConfig.c_cflag|=CREAD|CLOCAL;
Posix_CommConfig.c_lflag&=(~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG));
Posix_CommConfig.c_iflag&=(~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY));
Posix_CommConfig.c_oflag&=(~OPOST);
Posix_CommConfig.c_cc[VMIN]= 0;
#ifdef _POSIX_VDISABLE // Is a disable character available on this system?
// Some systems allow for per-device disable-characters, so get the
// proper value for the configured device
const long vdisable = fpathconf(fd, _PC_VDISABLE);
Posix_CommConfig.c_cc[VINTR] = vdisable;
Posix_CommConfig.c_cc[VQUIT] = vdisable;
Posix_CommConfig.c_cc[VSTART] = vdisable;
Posix_CommConfig.c_cc[VSTOP] = vdisable;
Posix_CommConfig.c_cc[VSUSP] = vdisable;
#endif //_POSIX_VDISABLE
setBaudRate(Settings.BaudRate);
setDataBits(Settings.DataBits);
setParity(Settings.Parity);
setStopBits(Settings.StopBits);
setFlowControl(Settings.FlowControl);
setTimeout(Settings.Timeout_Millisec);
tcsetattr(fd, TCSAFLUSH, &Posix_CommConfig);
} else {
qDebug("could not open file: %s", strerror(errno));
}
}
UNLOCK_MUTEX();
return isOpen();
}
示例12: QIODevice
Nuria::ReferenceDevice::ReferenceDevice (QIODevice *referencedDevice, QObject *parent)
: QIODevice (parent), d_ptr (new ReferenceDevicePrivate)
{
this->d_ptr->device = referencedDevice;
setOpenMode (referencedDevice->openMode ());
if (this->d_ptr->device->isSequential ()) {
nWarn() << "Device" << referencedDevice << "is not random-access!";
}
// Signal connections
connect (referencedDevice, &QIODevice::aboutToClose, this, &ReferenceDevice::close);
connect (referencedDevice, &QIODevice::readyRead, this, &ReferenceDevice::autoExtendRange);
connect (referencedDevice, &QObject::destroyed, this, &ReferenceDevice::referencedDeviceDestroyed);
}
示例13: kWarning
bool KoLimitedIODevice::open( QIODevice::OpenMode m )
{
//kDebug(7005) << "m=" << m;
if ( m & QIODevice::ReadOnly ) {
/*bool ok = false;
if ( m_dev->isOpen() )
ok = ( m_dev->mode() == QIODevice::ReadOnly );
else
ok = m_dev->open( m );
if ( ok )*/
m_dev->seek( m_start ); // No concurrent access !
}
else
kWarning(7005) << "KoLimitedIODevice::open only supports QIODevice::ReadOnly!";
setOpenMode( QIODevice::ReadOnly );
return true;
}
示例14: setOpenMode
/*!
\fn Posix_QextSerialPort& Posix_QextSerialPort::operator=(const Posix_QextSerialPort& s)
Override the = operator.
*/
Posix_QextSerialPort& Posix_QextSerialPort::operator=(const Posix_QextSerialPort& s)
{
setOpenMode(s.openMode());
port = s.port;
Settings.BaudRate=s.Settings.BaudRate;
Settings.DataBits=s.Settings.DataBits;
Settings.Parity=s.Settings.Parity;
Settings.StopBits=s.Settings.StopBits;
Settings.FlowControl=s.Settings.FlowControl;
lastErr=s.lastErr;
Posix_File=s.Posix_File;
memcpy(&Posix_Timeout, &(s.Posix_Timeout), sizeof(struct timeval));
memcpy(&Posix_Copy_Timeout, &(s.Posix_Copy_Timeout), sizeof(struct timeval));
memcpy(&Posix_CommConfig, &(s.Posix_CommConfig), sizeof(struct termios));
return *this;
}
示例15: writeData
void SocksClient::grantUDPAssociate(const QString &relayHost, int relayPort)
{
if(d->step != StepRequest || !d->waiting)
return;
// response
d->waiting = false;
writeData(sp_set_request(relayHost, relayPort, RET_SUCCESS));
d->udp = true;
setOpenMode(QIODevice::ReadWrite);
#ifdef PROX_DEBUG
fprintf(stderr, "SocksClient: server << Success >>\n");
#endif
if(!d->recvBuf.isEmpty())
d->recvBuf.resize(0);
}