diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-08-19 16:19:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-19 16:19:40 +0200 |
| commit | 846455f9585a7a44af5fb6d019fc76c5612c9d84 (patch) | |
| tree | abc36ab0c95a5daa57bdd319764e7f7b728f9cfa /src/ctx.cpp | |
| parent | 84713021edf688c9cf157562d34388583325aa45 (diff) | |
| parent | 8c41cfc3a714c532183a0c3542f86609ea1bc8ac (diff) | |
| download | PROJ-846455f9585a7a44af5fb6d019fc76c5612c9d84.tar.gz PROJ-846455f9585a7a44af5fb6d019fc76c5612c9d84.zip | |
Merge pull request #2329 from snowman2/ensure_cpp_context
Add methods to projCtx_t for safer interactions with cpp_context
Diffstat (limited to 'src/ctx.cpp')
| -rw-r--r-- | src/ctx.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ctx.cpp b/src/ctx.cpp index 930ae9ea..c2b30644 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -113,6 +113,30 @@ projCtx_t projCtx_t::createDefault() return ctx; } +/**************************************************************************/ +/* get_cpp_context() */ +/**************************************************************************/ + +projCppContext* projCtx_t::get_cpp_context() +{ + if (cpp_context == nullptr) { + cpp_context = new projCppContext(this); + } + return cpp_context; +} + + +/**************************************************************************/ +/* safeAutoCloseDbIfNeeded() */ +/**************************************************************************/ + +void projCtx_t::safeAutoCloseDbIfNeeded() +{ + if (cpp_context) { + cpp_context->autoCloseDbIfNeeded(); + } +} + /************************************************************************/ /* set_search_paths() */ /************************************************************************/ |
