19 #include <boost/algorithm/string.hpp>
24 namespace import_export {
31 return std::make_unique<QueryExporterCSV>();
35 return std::make_unique<QueryExporterGDAL>(file_type);
42 const std::string& file_path,
43 const std::string& file_type,
44 const std::unordered_set<std::string>& valid_extensions)
const {
45 auto extension = boost::algorithm::to_lower_copy(
46 boost::filesystem::path(file_path).extension().
string());
47 if (valid_extensions.find(extension) == valid_extensions.end()) {
48 throw std::runtime_error(
"Invalid file extension '" + extension +
49 "' for file type '" + file_type +
"'");
54 const int column_index) {
55 if (resname.size() == 0) {
std::string safeColumnName(const std::string &resname, const int column_index)
static std::unique_ptr< QueryExporter > create(const FileType file_type)
void validateFileExtensions(const std::string &file_path, const std::string &file_type, const std::unordered_set< std::string > &valid_extensions) const