19 #include <boost/algorithm/string.hpp>
20 #include <boost/filesystem.hpp>
25 namespace import_export {
32 return std::make_unique<QueryExporterCSV>();
37 return std::make_unique<QueryExporterGDAL>(file_type);
44 const std::string& file_path,
45 const std::string& file_type,
46 const std::unordered_set<std::string>& valid_extensions)
const {
47 auto extension = boost::algorithm::to_lower_copy(
48 boost::filesystem::path(file_path).extension().
string());
49 if (valid_extensions.find(extension) == valid_extensions.end()) {
50 throw std::runtime_error(
"Invalid file extension '" + extension +
51 "' for file type '" + file_type +
"'");
56 const int column_index) {
57 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