aboutsummaryrefslogtreecommitdiff
path: root/src/ctx.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-01-09 18:30:17 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-01-09 19:45:21 +0100
commit3cc9336b038118de424d018dd0bdd90e329ad8c1 (patch)
tree790ceaa32d7217f7667264217ecdec6db5c5d3b9 /src/ctx.cpp
parentd6dad2cee4307f6b190a96dd48942645060919cc (diff)
downloadPROJ-3cc9336b038118de424d018dd0bdd90e329ad8c1.tar.gz
PROJ-3cc9336b038118de424d018dd0bdd90e329ad8c1.zip
proj.h: add proj_context_set_file_finder() and proj_context_set_search_paths() (refs #1150)
Diffstat (limited to 'src/ctx.cpp')
-rw-r--r--src/ctx.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp
index a94eaf54..005070b0 100644
--- a/src/ctx.cpp
+++ b/src/ctx.cpp
@@ -100,6 +100,23 @@ projCtx_t projCtx_t::createDefault()
}
/************************************************************************/
+/* set_search_paths() */
+/************************************************************************/
+
+void projCtx_t::set_search_paths(const std::vector<std::string>& search_paths_in )
+{
+ search_paths = search_paths_in;
+ delete[] c_compat_paths;
+ c_compat_paths = nullptr;
+ if( !search_paths.empty() ) {
+ c_compat_paths = new const char*[search_paths.size()];
+ for( size_t i = 0; i < search_paths.size(); ++i ) {
+ c_compat_paths[i] = search_paths[i].c_str();
+ }
+ }
+}
+
+/************************************************************************/
/* projCtx_t(const projCtx_t& other) */
/************************************************************************/
@@ -110,6 +127,10 @@ projCtx_t::projCtx_t(const projCtx_t& other)
logger_app_data = other.logger_app_data;
fileapi = other.fileapi;
epsg_file_exists = other.epsg_file_exists;
+ set_search_paths(other.search_paths);
+ file_finder = other.file_finder;
+ file_finder_legacy = other.file_finder_legacy;
+ file_finder_user_data = other.file_finder_user_data;
}
/************************************************************************/
@@ -130,6 +151,7 @@ projCtx pj_get_default_ctx()
projCtx_t::~projCtx_t()
{
+ delete[] c_compat_paths;
proj_context_delete_cpp_context(cpp_context);
}
@@ -252,3 +274,4 @@ projFileAPI *pj_ctx_get_fileapi( projCtx ctx )
return nullptr;
return ctx->fileapi;
}
+