Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtextstream_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QTEXTSTREAM_P_H
6#define QTEXTSTREAM_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/private/qglobal_p.h>
20#include <QtCore/qstringconverter.h>
21#include <QtCore/qiodevice.h>
22#include <QtCore/qlocale.h>
23#include "qtextstream.h"
24
26
27#ifndef QT_NO_QOBJECT
29{
31public:
33 { }
34
36 {
37 disconnect();
38 if (device) {
39 // Force direct connection here so that QTextStream can be used
40 // from multiple threads when the application code is handling
41 // synchronization (see also QTBUG-12055).
42 connect(device, SIGNAL(aboutToClose()), this, SLOT(flushStream()),
44 }
45 this->stream = stream;
46 }
47
48public Q_SLOTS:
49 inline void flushStream() { stream->flush(); }
50
51private:
53};
54#endif
55
57{
58 Q_DECLARE_PUBLIC(QTextStream)
59public:
60 // streaming parameters
61 class Params
62 {
63 public:
64 void reset();
65
70 QTextStream::FieldAlignment fieldAlignment;
71 QTextStream::RealNumberNotation realNumberNotation;
72 QTextStream::NumberFlags numberFlags;
73 };
74
77 void reset();
78
79 // device
81#ifndef QT_NO_QOBJECT
83#endif
84
85 // string
88 QIODevice::OpenMode stringOpenMode;
89
94
98 int readConverterSavedStateOffset; //the offset between readBufferStartDevicePos and that start of the buffer
100
102
103 // status
104 QTextStream::Status status;
107
111 bool hasWrittenData = false;
112 bool generateBOM = false;
113
114 // i/o
120
121 QString read(int maxlen);
122 bool scan(const QChar **ptr, int *tokenLength,
123 int maxlen, TokenDelimiter delimiter);
124 inline const QChar *readPtr() const;
125 inline void consumeLastToken();
126 inline void consume(int nchars);
127 void saveConverterState(qint64 newPos);
129
130 // Return value type for getNumber()
136
137 inline bool getChar(QChar *ch);
138 inline void ungetChar(QChar ch);
140 bool getReal(double *f);
141
142 inline void write(QStringView data) { write(data.begin(), data.size()); }
143 inline void write(QChar ch);
144 void write(const QChar *data, qsizetype len);
147 inline void putString(QStringView string, bool number = false)
148 {
149 putString(string.constData(), string.size(), number);
150 }
151 void putString(const QChar *data, qsizetype len, bool number = false);
152 void putString(QLatin1StringView data, bool number = false);
153 void putString(QUtf8StringView data, bool number = false);
154 inline void putChar(QChar ch);
155 void putNumber(qulonglong number, bool negative);
156
159 };
161
162 // buffers
163 bool fillReadBuffer(qint64 maxBytes = -1);
164 void resetReadBuffer();
165 void flushWriteBuffer();
166};
167
169
170#endif // QTEXTSTREAM_P_H
IOBluetoothDevice * device
\inmodule QtCore
void setupDevice(QTextStream *stream, QIODevice *device)
\inmodule QtCore \reentrant
Definition qiodevice.h:34
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
Encoding
\value Utf8 Create a converter to or from UTF-8 \value Utf16 Create a converter to or from UTF-16.
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:78
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QTextStream::FieldAlignment fieldAlignment
QTextStream::RealNumberNotation realNumberNotation
QTextStream::NumberFlags numberFlags
void saveConverterState(qint64 newPos)
QTextStreamPrivate(QTextStream *q_ptr)
PaddingResult padding(qsizetype len) const
bool getChar(QChar *ch)
void putChar(QChar ch)
void ungetChar(QChar ch)
void restoreToSavedConverterState()
void write(QStringView data)
void writePadding(qsizetype len)
QString read(int maxlen)
QStringDecoder savedToUtf16
const QChar * readPtr() const
void putString(QStringView string, bool number=false)
bool scan(const QChar **ptr, int *tokenLength, int maxlen, TokenDelimiter delimiter)
qint64 readBufferStartDevicePos
bool fillReadBuffer(qint64 maxBytes=-1)
QTextStream * q_ptr
void consume(int nchars)
void putNumber(qulonglong number, bool negative)
QTextStream::Status status
QStringConverter::Encoding encoding
QDeviceClosedNotifier deviceClosedNotifier
QStringDecoder toUtf16
QStringEncoder fromUtf16
NumberParsingStatus getNumber(qulonglong *l)
QIODevice::OpenMode stringOpenMode
bool getReal(double *f)
\inmodule QtCore
Combined button and popup list for selecting options.
@ DirectConnection
EGLStreamKHR stream
static ControlElement< T > * ptr(QWidget *widget)
#define SLOT(a)
Definition qobjectdefs.h:52
#define SIGNAL(a)
Definition qobjectdefs.h:53
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLenum GLsizei len
#define Q_OBJECT
#define Q_SLOTS
quint64 qulonglong
Definition qtypes.h:64
ptrdiff_t qsizetype
Definition qtypes.h:165
long long qint64
Definition qtypes.h:60
myObject disconnect()
[26]