ContextBuilder for creating customized Context instances.
More...
#include <c2pa.hpp>
ContextBuilder for creating customized Context instances.
Provides a builder pattern for configuring contexts with multiple settings. Note: create_context() consumes the builder.
- Note
- For most use cases, prefer direct construction via the Context constructors. The ContextBuilder is useful when you need to layer multiple configuration sources (e.g. with_settings() followed by with_json()).
◆ ContextBuilder() [1/3]
| c2pa::Context::ContextBuilder::ContextBuilder |
( |
| ) |
|
◆ ~ContextBuilder()
| c2pa::Context::ContextBuilder::~ContextBuilder |
( |
| ) |
|
|
noexcept |
◆ ContextBuilder() [2/3]
◆ ContextBuilder() [3/3]
| c2pa::Context::ContextBuilder::ContextBuilder |
( |
const ContextBuilder & |
| ) |
|
|
delete |
◆ create_context()
| Context c2pa::Context::ContextBuilder::create_context |
( |
| ) |
|
Create a Context from the current builder configuration.
- Returns
- A new Context instance.
- Exceptions
-
- Note
- This consumes the builder. After calling this, is_valid() returns false.
◆ is_valid()
| bool c2pa::Context::ContextBuilder::is_valid |
( |
| ) |
const |
|
noexcept |
Check if the builder is in a valid state.
- Returns
- true if the builder can be used, false if moved from.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ with_json()
| ContextBuilder & c2pa::Context::ContextBuilder::with_json |
( |
const std::string & |
json | ) |
|
Configure settings with JSON string.
- Parameters
-
| json | JSON configuration string. |
- Returns
- Reference to this ContextBuilder for method chaining.
- Exceptions
-
◆ with_json_settings_file()
| ContextBuilder & c2pa::Context::ContextBuilder::with_json_settings_file |
( |
const std::filesystem::path & |
settings_path | ) |
|
Configure settings from a JSON settings file.
- Parameters
-
| settings_path | Full path to the JSON settings file. |
- Returns
- Reference to this ContextBuilder for method chaining.
- Exceptions
-
◆ with_settings()
Configure with Settings object.
- Parameters
-
| settings | Settings to use (will be copied into the context). Must be valid (is_valid() true). |
- Returns
- Reference to this ContextBuilder for method chaining.
- Exceptions
-
| C2paException | if settings are invalid or settings.is_valid() is false. |
◆ with_signer()
Set a Signer on the context being built.
After this call the source Signer object is consumed and must not be reused, as it becomes part to the context and tied to it. If settings also contain a signer, the programmatic signer set through this API will be used for signing.
- Parameters
-
| signer | Signer to put into the context. |
- Returns
- Reference to this ContextBuilder for method chaining.
- Exceptions
-
The documentation for this class was generated from the following file: