C2PA context implementing IContextProvider.
More...
#include <c2pa.hpp>
C2PA context implementing IContextProvider.
Context objects manage C2PA SDK configuration and state. Contexts can be created via direct construction or the ContextBuilder:
Direct construction:
C2PA context implementing IContextProvider.
Definition c2pa.hpp:261
ContextBuilder (for multi-step configuration):
ContextBuilder for creating customized Context instances.
Definition c2pa.hpp:269
Context create_context()
Create a Context from the current builder configuration.
ContextBuilder & with_json(const std::string &json)
Configure settings with JSON string.
ContextBuilder & with_settings(const Settings &settings)
Configure with Settings object.
Builder and Reader take the context by reference (IContextProvider&). The context object must outlive the Builder or Reader instance.
◆ Context() [1/7]
| c2pa::Context::Context |
( |
| ) |
|
Create a Context with default settings.
- Exceptions
-
◆ Context() [2/7]
| c2pa::Context::Context |
( |
const Settings & |
settings | ) |
|
|
explicit |
Create a Context configured with a Settings object.
- Parameters
-
| settings | Settings configuration to apply. Must be valid (settings.is_valid() true). |
- Exceptions
-
| C2paException | if settings are invalid, settings.is_valid() is false, or context creation fails. |
◆ Context() [3/7]
| c2pa::Context::Context |
( |
const std::string & |
json | ) |
|
|
explicit |
Create a Context configured with a JSON string.
- Parameters
-
| json | JSON configuration string. |
- Exceptions
-
◆ Context() [4/7]
| c2pa::Context::Context |
( |
const Settings & |
settings, |
|
|
Signer && |
signer |
|
) |
| |
Create a Context with a Settings object and a Signer.
- Parameters
-
| settings | Settings configuration to apply. |
| signer | Signer to move into the context. Consumed after this call. The programmatic Signer from the signer parameter takes priority over the Signer in settings, so use this API when wanting to explicitly set a Signer (or override the Signer in settings). |
- Exceptions
-
| C2paException | if settings or signer are invalid, or context creation fails. |
◆ Context() [5/7]
| c2pa::Context::Context |
( |
const Context & |
| ) |
|
|
delete |
◆ Context() [6/7]
| c2pa::Context::Context |
( |
Context && |
| ) |
|
|
noexcept |
◆ ~Context()
| c2pa::Context::~Context |
( |
| ) |
|
|
overridenoexcept |
◆ Context() [7/7]
| c2pa::Context::Context |
( |
C2paContext * |
ctx | ) |
|
|
explicit |
Internal constructor from raw FFI pointer (prefer public constructors).
- Parameters
-
| ctx | Raw C2paContext pointer — Context takes ownership. |
- Exceptions
-
◆ c_context()
| C2paContext * c2pa::Context::c_context |
( |
| ) |
const |
|
overridevirtualnoexcept |
Get the underlying C2PA context pointer.
- Returns
- C2paContext pointer when is_valid() is true; nullptr when moved-from (is_valid() false).
- Note
- Callers must check is_valid() before using the result; do not pass nullptr to the C API.
Implements c2pa::IContextProvider.
◆ is_valid()
| bool c2pa::Context::is_valid |
( |
| ) |
const |
|
overridevirtualnoexcept |
Check if this Context has a valid context (validity check for context-like types).
- Returns
- true when the object holds a valid C context; false when moved-from.
- Note
- After move, is_valid() is false and c_context() returns nullptr.
Implements c2pa::IContextProvider.
◆ operator=() [1/2]
◆ operator=() [2/2]
The documentation for this class was generated from the following file: