aboutsummaryrefslogtreecommitdiff
path: root/include/proj/internal/io_internal.hpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-01-17 17:01:20 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-01-17 21:57:27 +0100
commitc0ac895d77e823fe9a9458d013eb0f6378f39060 (patch)
tree9e7641cda61a75c3a6209d17dad6fa7c8448cd44 /include/proj/internal/io_internal.hpp
parent3121d9bc309b439adcc2ab9743a3d2b3a8f48296 (diff)
downloadPROJ-c0ac895d77e823fe9a9458d013eb0f6378f39060.tar.gz
PROJ-c0ac895d77e823fe9a9458d013eb0f6378f39060.zip
Remove proj_create_from_proj_string() and proj_create_from_user_input(), and make proj_create() do more or less what proj_create_from_user_input() did before (fixes #1214)
Diffstat (limited to 'include/proj/internal/io_internal.hpp')
-rw-r--r--include/proj/internal/io_internal.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/proj/internal/io_internal.hpp b/include/proj/internal/io_internal.hpp
index 62196fef..be6a11bd 100644
--- a/include/proj/internal/io_internal.hpp
+++ b/include/proj/internal/io_internal.hpp
@@ -36,6 +36,7 @@
#include <string>
#include <vector>
+#include "proj/io.hpp"
#include "proj/util.hpp"
//! @cond Doxygen_Suppress
@@ -159,6 +160,27 @@ class WKTConstants {
NS_PROJ_END
+// ---------------------------------------------------------------------------
+
+/** Auxiliary structure to PJ_CONTEXT storing C++ context stuff. */
+struct projCppContext {
+ NS_PROJ::io::DatabaseContextNNPtr databaseContext;
+ std::string lastUOMName_{};
+
+ explicit projCppContext(PJ_CONTEXT *ctx, const char *dbPath = nullptr,
+ const char *const *auxDbPaths = nullptr)
+ : databaseContext(NS_PROJ::io::DatabaseContext::create(
+ dbPath ? dbPath : std::string(), toVector(auxDbPaths), ctx)) {}
+
+ static std::vector<std::string> toVector(const char *const *auxDbPaths) {
+ std::vector<std::string> res;
+ for (auto iter = auxDbPaths; iter && *iter; ++iter) {
+ res.emplace_back(std::string(*iter));
+ }
+ return res;
+ }
+};
+
//! @endcond
#endif // IO_INTERNAL_HH_INCLUDED