diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e9d57a..1bc4975 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ cmake_minimum_required(VERSION 3.27) # This is the current version of this C++ project -project(c2pa-c VERSION 0.19.2) +project(c2pa-c VERSION 0.20.0) # Set the version of the c2pa_rs library used set(C2PA_VERSION "0.78.6") diff --git a/include/c2pa.hpp b/include/c2pa.hpp index 777368d..0d07354 100644 --- a/include/c2pa.hpp +++ b/include/c2pa.hpp @@ -317,9 +317,12 @@ namespace c2pa /// @note This consumes the builder. After calling this, is_valid() returns false. [[nodiscard]] Context create_context(); - /// @brief Get the underlying C2paContextBuilder pointer. + /// @brief Release ownership of the underlying C2paContextBuilder pointer. + /// After this call, the ContextBuilder no longer owns the pointer + /// and is_valid() returns false. The caller is responsible for managing + /// the lifetime of the returned pointer. /// @return Pointer to the C2paContextBuilder object, or nullptr if moved from. - C2paContextBuilder* c2pa_context_builder() const noexcept; + C2paContextBuilder* release() noexcept; private: C2paContextBuilder* context_builder; diff --git a/src/c2pa_context.cpp b/src/c2pa_context.cpp index f60e0c8..480d4f3 100644 --- a/src/c2pa_context.cpp +++ b/src/c2pa_context.cpp @@ -154,8 +154,8 @@ namespace c2pa return *this; } - C2paContextBuilder* Context::ContextBuilder::c2pa_context_builder() const noexcept { - return context_builder; + C2paContextBuilder* Context::ContextBuilder::release() noexcept { + return std::exchange(context_builder, nullptr); } Context Context::ContextBuilder::create_context() {