MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / writeToIODevice

Method writeToIODevice

3rdparty/qtcsv/sources/writer.cpp:132–156  ·  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

130// @output:
131// - bool - True if data could be written to the IO Device
132bool WriterPrivate::writeToIODevice(
133 QIODevice& ioDevice,
134 ContentIterator& content,
135 const QStringConverter::Encoding codec)
136{
137 if (content.isEmpty()) {
138 qDebug() << __FUNCTION__ << "Error - invalid arguments";
139 return false;
140 }
141
142 // Open IO Device if it was not opened
143 if (!ioDevice.isOpen() &&
144 !ioDevice.open(QIODevice::Append | QIODevice::Text))
145 {
146 qDebug() << __FUNCTION__ << "Error - failed to open IO Device";
147 return false;
148 }
149
150 QTextStream stream(&ioDevice);
151 stream.setEncoding(codec);
152 while (content.hasNext()) { stream << content.getNext(); }
153
154 stream.flush();
155 return stream.status() == QTextStream::Ok;
156}
157
158// Create unique name for the temporary file
159// @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