summaryrefslogtreecommitdiffstats
path: root/src/serialport/qt4support/include/private
diff options
context:
space:
mode:
Diffstat (limited to 'src/serialport/qt4support/include/private')
-rw-r--r--src/serialport/qt4support/include/private/qcore_mac_p.h140
-rw-r--r--src/serialport/qt4support/include/private/qcore_unix_p.h116
-rw-r--r--src/serialport/qt4support/include/private/qlockfile_p.h96
-rw-r--r--src/serialport/qt4support/include/private/qringbuffer_p.h311
4 files changed, 0 insertions, 663 deletions
diff --git a/src/serialport/qt4support/include/private/qcore_mac_p.h b/src/serialport/qt4support/include/private/qcore_mac_p.h
deleted file mode 100644
index a5c79fa8..00000000
--- a/src/serialport/qt4support/include/private/qcore_mac_p.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCORE_MAC_P_H
-#define QCORE_MAC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef __IMAGECAPTURE__
-# define __IMAGECAPTURE__
-#endif
-
-#if defined(QT_BOOTSTRAPPED)
-#include <ApplicationServices/ApplicationServices.h>
-#else
-#include <CoreFoundation/CoreFoundation.h>
-#endif
-
-#include "qglobal.h"
-
-#ifdef Q_OS_MACX
-#include <CoreServices/CoreServices.h>
-#endif
-
-#ifdef __OBJC__
-#include <Foundation/Foundation.h>
-#endif
-
-#include "qstring.h"
-
-#if defined( __OBJC__) && defined(QT_NAMESPACE)
-#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__) @compatibility_alias __KLASS__ QT_MANGLE_NAMESPACE(__KLASS__)
-#else
-#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__)
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*
- Helper class that automates refernce counting for CFtypes.
- After constructing the QCFType object, it can be copied like a
- value-based type.
-
- Note that you must own the object you are wrapping.
- This is typically the case if you get the object from a Core
- Foundation function with the word "Create" or "Copy" in it. If
- you got the object from a "Get" function, either retain it or use
- constructFromGet(). One exception to this rule is the
- HIThemeGet*Shape functions, which in reality are "Copy" functions.
-*/
-template <typename T>
-class Q_CORE_EXPORT QCFType
-{
-public:
- inline QCFType(const T &t = 0) : type(t) {}
- inline QCFType(const QCFType &helper) : type(helper.type) { if (type) CFRetain(type); }
- inline ~QCFType() { if (type) CFRelease(type); }
- inline operator T() { return type; }
- inline QCFType operator =(const QCFType &helper)
- {
- if (helper.type)
- CFRetain(helper.type);
- CFTypeRef type2 = type;
- type = helper.type;
- if (type2)
- CFRelease(type2);
- return *this;
- }
- inline T *operator&() { return &type; }
- template <typename X> X as() const { return reinterpret_cast<X>(type); }
- static QCFType constructFromGet(const T &t)
- {
- CFRetain(t);
- return QCFType<T>(t);
- }
-protected:
- T type;
-};
-
-class Q_CORE_EXPORT QCFString : public QCFType<CFStringRef>
-{
-public:
- inline QCFString(const QString &str) : QCFType<CFStringRef>(0), string(str) {}
- inline QCFString(const CFStringRef cfstr = 0) : QCFType<CFStringRef>(cfstr) {}
- inline QCFString(const QCFType<CFStringRef> &other) : QCFType<CFStringRef>(other) {}
- operator QString() const;
- operator CFStringRef() const;
- static QString toQString(CFStringRef cfstr);
- static CFStringRef toCFStringRef(const QString &str);
-#ifdef __OBJC__
- static QString toQString(const NSString *nsstr);
- static NSString *toNSString(const QString &string);
-#endif
-
-private:
- QString string;
-};
-
-QT_END_NAMESPACE
-
-#endif // QCORE_MAC_P_H
diff --git a/src/serialport/qt4support/include/private/qcore_unix_p.h b/src/serialport/qt4support/include/private/qcore_unix_p.h
deleted file mode 100644
index 6a7fb725..00000000
--- a/src/serialport/qt4support/include/private/qcore_unix_p.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCORE_UNIX_P_H
-#define QCORE_UNIX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of Qt code on Unix. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qplatformdefs.h"
-
-#ifndef Q_OS_UNIX
-# error "qcore_unix_p.h included on a non-Unix system"
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <fcntl.h>
-
-#define EINTR_LOOP(var, cmd) \
- do { \
- var = cmd; \
- } while (var == -1 && errno == EINTR)
-
-QT_BEGIN_NAMESPACE
-
-// don't call QT_OPEN or ::open
-// call qt_safe_open
-static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 0777)
-{
-#ifdef O_CLOEXEC
- flags |= O_CLOEXEC;
-#endif
- register int fd;
- EINTR_LOOP(fd, QT_OPEN(pathname, flags, mode));
-
- // unknown flags are ignored, so we have no way of verifying if
- // O_CLOEXEC was accepted
- if (fd != -1)
- ::fcntl(fd, F_SETFD, FD_CLOEXEC);
- return fd;
-}
-#undef QT_OPEN
-#define QT_OPEN qt_safe_open
-
-static inline qint64 qt_safe_read(int fd, void *data, qint64 maxlen)
-{
- qint64 ret = 0;
- EINTR_LOOP(ret, QT_READ(fd, data, maxlen));
- return ret;
-}
-#undef QT_READ
-#define QT_READ qt_safe_read
-
-static inline qint64 qt_safe_write(int fd, const void *data, qint64 len)
-{
- qint64 ret = 0;
- EINTR_LOOP(ret, QT_WRITE(fd, data, len));
- return ret;
-}
-#undef QT_WRITE
-#define QT_WRITE qt_safe_write
-
-static inline int qt_safe_close(int fd)
-{
- register int ret;
- EINTR_LOOP(ret, QT_CLOSE(fd));
- return ret;
-}
-#undef QT_CLOSE
-#define QT_CLOSE qt_safe_close
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/serialport/qt4support/include/private/qlockfile_p.h b/src/serialport/qt4support/include/private/qlockfile_p.h
deleted file mode 100644
index ec36733e..00000000
--- a/src/serialport/qt4support/include/private/qlockfile_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCKFILE_P_H
-#define QLOCKFILE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qlockfile.h>
-#include <QtCore/qfile.h>
-
-#ifdef Q_OS_WIN
-#include <qt_windows.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QLockFilePrivate
-{
-public:
- QLockFilePrivate(const QString &fn)
- : fileName(fn),
-#ifdef Q_OS_WIN
- fileHandle(INVALID_HANDLE_VALUE),
-#else
- fileHandle(-1),
-#endif
- staleLockTime(30 * 1000), // 30 seconds
- lockError(QLockFile::NoError),
- isLocked(false)
- {
- }
- QLockFile::LockError tryLock_sys();
- bool removeStaleLock();
- bool getLockInfo(qint64 *pid, QString *hostname, QString *appname) const;
- // Returns \c true if the lock belongs to dead PID, or is old.
- // The attempt to delete it will tell us if it was really stale or not, though.
- bool isApparentlyStale() const;
-
-#ifdef Q_OS_UNIX
- static int checkFcntlWorksAfterFlock();
-#endif
-
- QString fileName;
-#ifdef Q_OS_WIN
- Qt::HANDLE fileHandle;
-#else
- int fileHandle;
-#endif
- int staleLockTime; // "int milliseconds" is big enough for 24 days
- QLockFile::LockError lockError;
- bool isLocked;
-};
-
-QT_END_NAMESPACE
-
-#endif /* QLOCKFILE_P_H */
diff --git a/src/serialport/qt4support/include/private/qringbuffer_p.h b/src/serialport/qt4support/include/private/qringbuffer_p.h
deleted file mode 100644
index 2279f1bc..00000000
--- a/src/serialport/qt4support/include/private/qringbuffer_p.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRINGBUFFER_P_H
-#define QRINGBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qlist.h>
-
-QT_BEGIN_NAMESPACE
-
-class QRingBuffer
-{
-public:
- explicit inline QRingBuffer(int growth = 4096) :
- head(0), tail(0), tailBuffer(0), basicBlockSize(growth), bufferSize(0) {
- buffers.append(QByteArray());
- }
-
- inline int nextDataBlockSize() const {
- return (tailBuffer == 0 ? tail : buffers.first().size()) - head;
- }
-
- inline const char *readPointer() const {
- return buffers.isEmpty() ? 0 : (buffers.first().constData() + head);
- }
-
- // access the bytes at a specified position
- // the out-variable length will contain the amount of bytes readable
- // from there, e.g. the amount still the same QByteArray
- inline const char *readPointerAtPosition(qint64 pos, qint64 &length) const {
- if (pos >= 0) {
- pos += head;
- for (int i = 0; i < buffers.size(); ++i) {
- length = (i == tailBuffer ? tail : buffers[i].size());
- if (length > pos) {
- length -= pos;
- return buffers[i].constData() + pos;
- }
- pos -= length;
- }
- }
-
- length = 0;
- return 0;
- }
-
- inline void free(int bytes) {
- while (bytes > 0) {
- int blockSize = buffers.first().size() - head;
-
- if (tailBuffer == 0 || blockSize > bytes) {
- bufferSize -= bytes;
- if (bufferSize <= 0)
- clear(); // try to minify/squeeze us
- else
- head += bytes;
- return;
- }
-
- bufferSize -= blockSize;
- bytes -= blockSize;
- buffers.removeFirst();
- --tailBuffer;
- head = 0;
- }
- }
-
- inline char *reserve(int bytes) {
- if (bytes <= 0)
- return 0;
-
- // if need buffer reallocation
- if (tail + bytes > buffers.last().size()) {
- if (tail >= basicBlockSize) {
- // shrink this buffer to its current size
- buffers.last().resize(tail);
-
- // create a new QByteArray
- buffers.append(QByteArray());
- ++tailBuffer;
- tail = 0;
- }
- buffers.last().resize(qMax(basicBlockSize, tail + bytes));
- }
-
- char *writePtr = buffers.last().data() + tail;
- bufferSize += bytes;
- tail += bytes;
- return writePtr;
- }
-
- inline void truncate(int pos) {
- if (pos < size())
- chop(size() - pos);
- }
-
- inline void chop(int bytes) {
- while (bytes > 0) {
- if (tailBuffer == 0 || tail > bytes) {
- bufferSize -= bytes;
- if (bufferSize <= 0)
- clear(); // try to minify/squeeze us
- else
- tail -= bytes;
- return;
- }
-
- bufferSize -= tail;
- bytes -= tail;
- buffers.removeLast();
- --tailBuffer;
- tail = buffers.last().size();
- }
- }
-
- inline bool isEmpty() const {
- return tailBuffer == 0 && tail == 0;
- }
-
- inline int getChar() {
- if (isEmpty())
- return -1;
- char c = *readPointer();
- free(1);
- return int(uchar(c));
- }
-
- inline void putChar(char c) {
- char *ptr = reserve(1);
- *ptr = c;
- }
-
- inline void ungetChar(char c) {
- --head;
- if (head < 0) {
- buffers.prepend(QByteArray());
- buffers.first().resize(basicBlockSize);
- head = basicBlockSize - 1;
- ++tailBuffer;
- }
- buffers.first()[head] = c;
- ++bufferSize;
- }
-
- inline int size() const {
- return bufferSize;
- }
-
- inline void clear() {
- buffers.erase(buffers.begin() + 1, buffers.end());
- buffers.first().clear();
-
- head = tail = 0;
- tailBuffer = 0;
- bufferSize = 0;
- }
-
- inline int indexOf(char c) const {
- int index = 0;
- int j = head;
- for (int i = 0; i < buffers.size(); ++i) {
- const char *ptr = buffers[i].constData() + j;
- j = index + (i == tailBuffer ? tail : buffers[i].size()) - j;
-
- while (index < j) {
- if (*ptr++ == c)
- return index;
- ++index;
- }
- j = 0;
- }
- return -1;
- }
-
- inline int indexOf(char c, int maxLength) const {
- int index = 0;
- int j = head;
- for (int i = 0; index < maxLength && i < buffers.size(); ++i) {
- const char *ptr = buffers[i].constData() + j;
- j = qMin(index + (i == tailBuffer ? tail : buffers[i].size()) - j, maxLength);
-
- while (index < j) {
- if (*ptr++ == c)
- return index;
- ++index;
- }
- j = 0;
- }
- return -1;
- }
-
- inline int read(char *data, int maxLength) {
- int bytesToRead = qMin(size(), maxLength);
- int readSoFar = 0;
- while (readSoFar < bytesToRead) {
- int bytesToReadFromThisBlock = qMin(bytesToRead - readSoFar, nextDataBlockSize());
- if (data)
- memcpy(data + readSoFar, readPointer(), bytesToReadFromThisBlock);
- readSoFar += bytesToReadFromThisBlock;
- free(bytesToReadFromThisBlock);
- }
- return readSoFar;
- }
-
- // read an unspecified amount (will read the first buffer)
- inline QByteArray read() {
- if (bufferSize == 0)
- return QByteArray();
-
- QByteArray qba(buffers.takeFirst());
-
- qba.reserve(0); // avoid that resizing needlessly reallocates
- if (tailBuffer == 0) {
- qba.resize(tail);
- tail = 0;
- buffers.append(QByteArray());
- } else {
- --tailBuffer;
- }
- qba.remove(0, head); // does nothing if head is 0
- head = 0;
- bufferSize -= qba.size();
- return qba;
- }
-
- // append a new buffer to the end
- inline void append(const QByteArray &qba) {
- if (tail == 0) {
- buffers.last() = qba;
- } else {
- buffers.last().resize(tail);
- buffers.append(qba);
- ++tailBuffer;
- }
- tail = qba.size();
- bufferSize += tail;
- }
-
- inline int skip(int length) {
- return read(0, length);
- }
-
- inline int readLine(char *data, int maxLength) {
- if (!data || --maxLength <= 0)
- return -1;
-
- int i = indexOf('\n', maxLength);
- i = read(data, i >= 0 ? (i + 1) : maxLength);
-
- // Terminate it.
- data[i] = '\0';
- return i;
- }
-
- inline bool canReadLine() const {
- return indexOf('\n') >= 0;
- }
-
-private:
- QList<QByteArray> buffers;
- int head, tail;
- int tailBuffer; // always buffers.size() - 1
- const int basicBlockSize;
- int bufferSize;
-};
-
-QT_END_NAMESPACE
-
-#endif // QRINGBUFFER_P_H