MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / writeToIODevice

Method writeToIODevice

3rdparty/qtcsv-qt5/sources/writer.cpp:143–172  ·  view source on GitHub ↗

Write csv data to IO Device @input: - iodevice - IO Device to write data to - content - not empty handler of content for csv-file - codec - pointer to codec object that would be used for file writing @output: - bool - True if data could be written to the IO Device

Source from the content-addressed store, hash-verified

141// @output:
142// - bool - True if data could be written to the IO Device
143bool WriterPrivate::writeToIODevice(
144 QIODevice& ioDevice,
145 ContentIterator& content,
146 QTextCodec* codec)
147{
148 if (content.isEmpty())
149 {
150 qDebug() << __FUNCTION__ << "Error - invalid arguments";
151 return false;
152 }
153
154 // Open IO Device if it was not opened
155 if (false == ioDevice.isOpen() &&
156 false == ioDevice.open(QIODevice::Append | QIODevice::Text))
157 {
158 qDebug() << __FUNCTION__ << "Error - failed to open IO Device";
159 return false;
160 }
161
162 QTextStream stream(&ioDevice);
163 stream.setCodec(codec);
164 while(content.hasNext())
165 {
166 stream << content.getNext();
167 }
168
169 stream.flush();
170
171 return stream.status() == QTextStream::Ok;
172}
173
174// Create unique name for the temporary file
175// @output:

Callers

nothing calls this directly

Calls 4

isEmptyMethod · 0.45
hasNextMethod · 0.45
getNextMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected