Sort datasets on input
This commit is contained in:
@@ -132,6 +132,7 @@ namespace platform {
|
|||||||
for (const auto& dataset_ : table.items()) {
|
for (const auto& dataset_ : table.items()) {
|
||||||
datasets.push_back(dataset_.key());
|
datasets.push_back(dataset_.key());
|
||||||
}
|
}
|
||||||
|
std::stable_sort(datasets.begin(), datasets.end());
|
||||||
maxDatasetName = (*max_element(datasets.begin(), datasets.end(), [](const std::string& a, const std::string& b) { return a.size() < b.size(); })).size();
|
maxDatasetName = (*max_element(datasets.begin(), datasets.end(), [](const std::string& a, const std::string& b) { return a.size() < b.size(); })).size();
|
||||||
maxDatasetName = std::max(7, maxDatasetName);
|
maxDatasetName = std::max(7, maxDatasetName);
|
||||||
return datasets;
|
return datasets;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include<algorithm>
|
||||||
#include "Datasets.h"
|
#include "Datasets.h"
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
@@ -24,10 +25,15 @@ namespace platform {
|
|||||||
throw std::invalid_argument("Unable to open catalog file. [" + path + "all.txt" + "]");
|
throw std::invalid_argument("Unable to open catalog file. [" + path + "all.txt" + "]");
|
||||||
}
|
}
|
||||||
std::string line;
|
std::string line;
|
||||||
|
std::vector<std::string> sorted_lines;
|
||||||
while (getline(catalog, line)) {
|
while (getline(catalog, line)) {
|
||||||
if (line.empty() || line[0] == '#') {
|
if (line.empty() || line[0] == '#') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
sorted_lines.push_back(line);
|
||||||
|
}
|
||||||
|
std::stable_sort(sorted_lines.begin(), sorted_lines.end());
|
||||||
|
for (const auto& line : sorted_lines) {
|
||||||
std::vector<std::string> tokens = split(line, ';');
|
std::vector<std::string> tokens = split(line, ';');
|
||||||
std::string name = tokens[0];
|
std::string name = tokens[0];
|
||||||
std::string className;
|
std::string className;
|
||||||
|
Reference in New Issue
Block a user