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

Method getNext

3rdparty/qtcsv/sources/contentiterator.cpp:44–88  ·  view source on GitHub ↗

Get next chunk of information @output: - QString - next chunk of information. If there is no more information to return, function will return empty string

Source from the content-addressed store, hash-verified

42// - QString - next chunk of information. If there is no more information to
43// return, function will return empty string
44QString ContentIterator::getNext() {
45 // Check if we have already get to the end of the content
46 if (m_atEnd) { return {}; }
47
48 QString content;
49 qsizetype rowsNumber = 0;
50
51 // Initially m_dataRow have negative value. Negative value indicates that
52 // client have called this function first time. In this case at the
53 // beginning of the chunk we should place header information. And then
54 // set m_dataRow to the index of the first row in main data container.
55 if (m_dataRow < 0) {
56 if (!m_header.isEmpty()) {
57 content.append(composeRow(m_header));
58 ++rowsNumber;
59 }
60
61 m_dataRow = 0;
62 }
63
64 // Check if m_dataRow is less than number of rows in m_data. If this is
65 // true, add information from the m_data to the chunk. Otherwise, this means
66 // that we already have passed all information from the m_data.
67 if (m_dataRow < m_data.rowCount()) {
68 const auto endRow =
69 qMin(m_dataRow + m_chunkSize - rowsNumber, m_data.rowCount());
70 for (auto i = m_dataRow; i < endRow; ++i, ++m_dataRow, ++rowsNumber) {
71 content.append(composeRow(m_data.rowValues(i)));
72 }
73 }
74
75 // If we still have place in chunk, try to add footer information to it.
76 if (rowsNumber < m_chunkSize) {
77 if (!m_footer.isEmpty()) {
78 content.append(composeRow(m_footer));
79 ++rowsNumber;
80 }
81
82 // At this point chunk contains the last row - footer. That
83 // means that we get to the end of content.
84 m_atEnd = true;
85 }
86
87 return content;
88}
89
90// Compose row string from values
91// @input:

Callers 1

writeToIODeviceMethod · 0.45

Calls 4

appendMethod · 0.80
isEmptyMethod · 0.45
rowCountMethod · 0.45
rowValuesMethod · 0.45

Tested by

no test coverage detected