diff options
Diffstat (limited to 'src/ctx.cpp')
| -rw-r--r-- | src/ctx.cpp | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp index 6dbe0de5..24d3773b 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * Project: PROJ.4 - * Purpose: Implementation of the projCtx thread context object. + * Purpose: Implementation of the PJ_CONTEXT thread context object. * Author: Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** @@ -43,7 +43,7 @@ /* pj_get_ctx() */ /************************************************************************/ -projCtx pj_get_ctx( projPJ pj ) +PJ_CONTEXT* pj_get_ctx( PJ *pj ) { if (nullptr==pj) @@ -59,7 +59,7 @@ projCtx pj_get_ctx( projPJ pj ) /* Note we do not deallocate the old context! */ /************************************************************************/ -void pj_set_ctx( projPJ pj, projCtx ctx ) +void pj_set_ctx( PJ *pj, PJ_CONTEXT *ctx ) { if (pj==nullptr) @@ -86,7 +86,7 @@ void pj_set_ctx( projPJ pj, projCtx ctx ) * the user may want to assign another thread-specific context to the * object. */ -void proj_assign_context( PJ* pj, PJ_CONTEXT* ctx ) +void proj_assign_context( PJ* pj, PJ_CONTEXT *ctx ) { pj_set_ctx( pj, ctx ); } @@ -95,9 +95,9 @@ void proj_assign_context( PJ* pj, PJ_CONTEXT* ctx ) /* createDefault() */ /************************************************************************/ -projCtx_t projCtx_t::createDefault() +pj_ctx pj_ctx::createDefault() { - projCtx_t ctx; + pj_ctx ctx; ctx.debug_level = PJ_LOG_NONE; ctx.logger = pj_stderr_logger; ctx.fileapi_legacy = pj_get_default_fileapi(); @@ -117,7 +117,7 @@ projCtx_t projCtx_t::createDefault() /* get_cpp_context() */ /**************************************************************************/ -projCppContext* projCtx_t::get_cpp_context() +projCppContext* pj_ctx::get_cpp_context() { if (cpp_context == nullptr) { cpp_context = new projCppContext(this); @@ -125,12 +125,11 @@ projCppContext* projCtx_t::get_cpp_context() return cpp_context; } - /**************************************************************************/ /* safeAutoCloseDbIfNeeded() */ /**************************************************************************/ -void projCtx_t::safeAutoCloseDbIfNeeded() +void pj_ctx::safeAutoCloseDbIfNeeded() { if (cpp_context) { cpp_context->autoCloseDbIfNeeded(); @@ -141,7 +140,7 @@ void projCtx_t::safeAutoCloseDbIfNeeded() /* set_search_paths() */ /************************************************************************/ -void projCtx_t::set_search_paths(const std::vector<std::string>& search_paths_in ) +void pj_ctx::set_search_paths(const std::vector<std::string>& search_paths_in ) { search_paths = search_paths_in; delete[] c_compat_paths; @@ -158,16 +157,16 @@ void projCtx_t::set_search_paths(const std::vector<std::string>& search_paths_in /* set_ca_bundle_path() */ /**************************************************************************/ -void projCtx_t::set_ca_bundle_path(const std::string& ca_bundle_path_in) +void pj_ctx::set_ca_bundle_path(const std::string& ca_bundle_path_in) { ca_bundle_path = ca_bundle_path_in; } /************************************************************************/ -/* projCtx_t(const projCtx_t& other) */ +/* pj_ctx(const pj_ctx& other) */ /************************************************************************/ -projCtx_t::projCtx_t(const projCtx_t& other) : +pj_ctx::pj_ctx(const pj_ctx& other) : debug_level(other.debug_level), logger(other.logger), logger_app_data(other.logger_app_data), @@ -197,19 +196,19 @@ projCtx_t::projCtx_t(const projCtx_t& other) : /* pj_get_default_ctx() */ /************************************************************************/ -projCtx pj_get_default_ctx() +PJ_CONTEXT* pj_get_default_ctx() { // C++11 rules guarantee a thread-safe instantiation. - static projCtx_t default_context(projCtx_t::createDefault()); + static pj_ctx default_context(pj_ctx::createDefault()); return &default_context; } /************************************************************************/ -/* ~projCtx_t() */ +/* ~pj_ctx() */ /************************************************************************/ -projCtx_t::~projCtx_t() +pj_ctx::~pj_ctx() { delete[] c_compat_paths; proj_context_delete_cpp_context(cpp_context); @@ -219,10 +218,10 @@ projCtx_t::~projCtx_t() /* pj_ctx_alloc() */ /************************************************************************/ -projCtx pj_ctx_alloc() +PJ_CONTEXT* pj_ctx_alloc() { - return new (std::nothrow) projCtx_t(*pj_get_default_ctx()); + return new (std::nothrow) pj_ctx(*pj_get_default_ctx()); } /************************************************************************/ @@ -230,19 +229,19 @@ projCtx pj_ctx_alloc() /* Create a new context based on a custom context */ /************************************************************************/ -PJ_CONTEXT *proj_context_clone (PJ_CONTEXT *ctx) +PJ_CONTEXT* proj_context_clone (PJ_CONTEXT *ctx) { if (nullptr==ctx) return pj_ctx_alloc (); - return new (std::nothrow) projCtx_t(*ctx); + return new (std::nothrow) pj_ctx(*ctx); } /************************************************************************/ /* pj_ctx_free() */ /************************************************************************/ -void pj_ctx_free( projCtx ctx ) +void pj_ctx_free( PJ_CONTEXT *ctx ) { delete ctx; @@ -252,7 +251,7 @@ void pj_ctx_free( projCtx ctx ) /* pj_ctx_get_errno() */ /************************************************************************/ -int pj_ctx_get_errno( projCtx ctx ) +int pj_ctx_get_errno( PJ_CONTEXT *ctx ) { if (nullptr==ctx) @@ -266,7 +265,7 @@ int pj_ctx_get_errno( projCtx ctx ) /* Also sets the global errno */ /************************************************************************/ -void pj_ctx_set_errno( projCtx ctx, int new_errno ) +void pj_ctx_set_errno( PJ_CONTEXT *ctx, int new_errno ) { ctx->last_errno = new_errno; @@ -280,7 +279,7 @@ void pj_ctx_set_errno( projCtx ctx, int new_errno ) /* pj_ctx_set_debug() */ /************************************************************************/ -void pj_ctx_set_debug( projCtx ctx, int new_debug ) +void pj_ctx_set_debug( PJ_CONTEXT *ctx, int new_debug ) { if (nullptr==ctx) @@ -292,7 +291,7 @@ void pj_ctx_set_debug( projCtx ctx, int new_debug ) /* pj_ctx_set_logger() */ /************************************************************************/ -void pj_ctx_set_logger( projCtx ctx, void (*new_logger)(void*,int,const char*) ) +void pj_ctx_set_logger( PJ_CONTEXT *ctx, void (*new_logger)(void*,int,const char*) ) { if (nullptr==ctx) @@ -304,7 +303,7 @@ void pj_ctx_set_logger( projCtx ctx, void (*new_logger)(void*,int,const char*) ) /* pj_ctx_set_app_data() */ /************************************************************************/ -void pj_ctx_set_app_data( projCtx ctx, void *new_app_data ) +void pj_ctx_set_app_data( PJ_CONTEXT *ctx, void *new_app_data ) { if (nullptr==ctx) @@ -316,7 +315,7 @@ void pj_ctx_set_app_data( projCtx ctx, void *new_app_data ) /* pj_ctx_get_app_data() */ /************************************************************************/ -void *pj_ctx_get_app_data( projCtx ctx ) +void *pj_ctx_get_app_data( PJ_CONTEXT *ctx ) { if (nullptr==ctx) |
