| 158 | } |
| 159 | |
| 160 | ROOTFilterPrivate::FileType ROOTFilterPrivate::currentObjectPosition(const QString& fileName, long int& pos) { |
| 161 | auto typeobject = currentObject.split(QLatin1Char(':')); |
| 162 | if (typeobject.size() < 2) { |
| 163 | q->setLastError(i18n("Unsupported file type, neither histogram no tree.")); |
| 164 | return FileType::Invalid; |
| 165 | } |
| 166 | |
| 167 | FileType type; |
| 168 | if (typeobject.first() == QStringLiteral("Hist")) |
| 169 | type = FileType::Hist; |
| 170 | else if (typeobject.first() == QStringLiteral("Tree")) |
| 171 | type = FileType::Tree; |
| 172 | else |
| 173 | return FileType::Invalid; |
| 174 | |
| 175 | typeobject.removeFirst(); |
| 176 | auto path = typeobject.join(QLatin1Char(':')).split(QLatin1Char('/')); |
| 177 | const auto& dir = (type == FileType::Hist) ? listHistograms(fileName) : listTrees(fileName); |
| 178 | const auto* node = &dir; |
| 179 | while (path.size() > 1) { |
| 180 | bool next = false; |
| 181 | for (const auto& child : node->children) { |
| 182 | if (child.name == path.first()) { |
| 183 | node = &child; |
| 184 | path.pop_front(); |
| 185 | next = true; |
| 186 | break; |
| 187 | } |
| 188 | } |
| 189 | if (!next) |
| 190 | return FileType::Invalid; |
| 191 | } |
| 192 | for (const auto& child : node->content) { |
| 193 | if (child.first == path.first()) { |
| 194 | pos = child.second; |
| 195 | break; |
| 196 | } |
| 197 | } |
| 198 | return type; |
| 199 | } |
| 200 | |
| 201 | void ROOTFilterPrivate::readDataFromFile(const QString& fileName, AbstractDataSource* dataSource, AbstractFileFilter::ImportMode importMode) { |
| 202 | DEBUG(Q_FUNC_INFO << ", object: " << STDSTRING(currentObject)); |
nothing calls this directly
no test coverage detected