| 152 | } |
| 153 | |
| 154 | void Notebook::parseData(int row) { |
| 155 | const QString& name = m_variableModel->data(m_variableModel->index(row, 0)).toString(); |
| 156 | QVariant dataValue = m_variableModel->data(m_variableModel->index(row, 1), 257); |
| 157 | if (dataValue.isNull()) |
| 158 | dataValue = m_variableModel->data(m_variableModel->index(row, 1)); |
| 159 | |
| 160 | const QString& value = dataValue.toString(); |
| 161 | VariableParser parser(m_backendName, value); |
| 162 | |
| 163 | if (parser.isParsed()) { |
| 164 | auto* col = child<Column>(name); |
| 165 | if (col) { |
| 166 | switch (parser.dataType()) { |
| 167 | case AbstractColumn::ColumnMode::Integer: |
| 168 | col->setColumnMode(AbstractColumn::ColumnMode::Integer); |
| 169 | col->setIntegers(parser.integers()); |
| 170 | break; |
| 171 | case AbstractColumn::ColumnMode::BigInt: |
| 172 | col->setColumnMode(AbstractColumn::ColumnMode::BigInt); |
| 173 | col->setBigInts(parser.bigInt()); |
| 174 | break; |
| 175 | case AbstractColumn::ColumnMode::Double: |
| 176 | col->setColumnMode(AbstractColumn::ColumnMode::Double); |
| 177 | col->setValues(parser.doublePrecision()); |
| 178 | break; |
| 179 | case AbstractColumn::ColumnMode::Month: |
| 180 | case AbstractColumn::ColumnMode::Day: |
| 181 | case AbstractColumn::ColumnMode::DateTime: |
| 182 | col->setColumnMode(AbstractColumn::ColumnMode::DateTime); |
| 183 | col->setDateTimes(parser.dateTime()); |
| 184 | break; |
| 185 | case AbstractColumn::ColumnMode::Text: |
| 186 | col->setColumnMode(AbstractColumn::ColumnMode::Text); |
| 187 | col->setText(parser.text()); |
| 188 | break; |
| 189 | } |
| 190 | } else { |
| 191 | // Column doesn't exist for this variable yet either because it was not defined yet or |
| 192 | // because its values was changed now to an array-like structure after the initial definition. |
| 193 | // -> create a new column for the current variable |
| 194 | switch (parser.dataType()) { |
| 195 | case AbstractColumn::ColumnMode::Integer: |
| 196 | col = new Column(name, parser.integers()); |
| 197 | break; |
| 198 | case AbstractColumn::ColumnMode::BigInt: |
| 199 | col = new Column(name, parser.bigInt()); |
| 200 | break; |
| 201 | case AbstractColumn::ColumnMode::Double: |
| 202 | col = new Column(name, parser.doublePrecision()); |
| 203 | break; |
| 204 | case AbstractColumn::ColumnMode::Month: |
| 205 | case AbstractColumn::ColumnMode::Day: |
| 206 | case AbstractColumn::ColumnMode::DateTime: |
| 207 | col = new Column(name, parser.dateTime(), parser.dataType()); |
| 208 | break; |
| 209 | case AbstractColumn::ColumnMode::Text: |
| 210 | col = new Column(name, parser.text()); |
| 211 | break; |
nothing calls this directly
no test coverage detected