From c0ac895d77e823fe9a9458d013eb0f6378f39060 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 17 Jan 2019 17:01:20 +0100 Subject: 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) --- include/proj/internal/io_internal.hpp | 22 ++++++++++++++++++++++ include/proj/io.hpp | 8 ++++++++ 2 files changed, 30 insertions(+) (limited to 'include') 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 #include +#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 toVector(const char *const *auxDbPaths) { + std::vector res; + for (auto iter = auxDbPaths; iter && *iter; ++iter) { + res.emplace_back(std::string(*iter)); + } + return res; + } +}; + //! @endcond #endif // IO_INTERNAL_HH_INCLUDED diff --git a/include/proj/io.hpp b/include/proj/io.hpp index 813b4bdb..18852cce 100644 --- a/include/proj/io.hpp +++ b/include/proj/io.hpp @@ -602,6 +602,9 @@ createFromUserInput(const std::string &text, const DatabaseContextPtr &dbContext, bool usePROJ4InitRules = false); +PROJ_DLL util::BaseObjectNNPtr createFromUserInput(const std::string &text, + PJ_CONTEXT *ctx); + // --------------------------------------------------------------------------- /** \brief Parse a WKT string into the appropriate suclass of util::BaseObject. @@ -664,6 +667,11 @@ class PROJ_GCC_DLL PROJStringParser { PROJ_DLL util::BaseObjectNNPtr createFromPROJString( const std::string &projString); // throw(ParsingException) + PROJ_PRIVATE : + //! @cond Doxygen_Suppress + PROJStringParser & + attachContext(PJ_CONTEXT *ctx); + //! @endcond private: PROJ_OPAQUE_PRIVATE_DATA }; -- cgit v1.2.3