(C2PA SDK) Settings configuration object for creating contexts.
More...
#include <c2pa.hpp>
|
| | Settings () |
| | Create default settings.
|
| |
| | Settings (const std::string &data, const std::string &format) |
| | Create settings from a configuration string.
|
| |
| | Settings (Settings &&) noexcept |
| |
| Settings & | operator= (Settings &&) noexcept |
| |
| | Settings (const Settings &)=delete |
| |
| Settings & | operator= (const Settings &)=delete |
| |
| | ~Settings () noexcept |
| |
| bool | is_valid () const noexcept |
| | Check if this Settings object is valid (holds a C settings handle).
|
| |
| Settings & | set (const std::string &path, const std::string &json_value) |
| | Set a single configuration value by path.
|
| |
| Settings & | update (const std::string &data) |
| | Merge configuration from a JSON string (latest configuration wins).
|
| |
| Settings & | update (const std::string &data, const std::string &format) |
| | Merge configuration from a std::string (latest configuration wins).
|
| |
| C2paSettings * | c_settings () const noexcept |
| | Get the raw C FFI settings pointer.
|
| |
(C2PA SDK) Settings configuration object for creating contexts.
Settings can be configured via JSON strings or programmatically via set() and update() methods. Once passed to Context::ContextBuilder, the settings are copied into the context and the Settings object can be reused or discarded.
- Validity
- Settings uses is_valid() to indicate whether the object holds a valid underlying C settings handle. After move-from, is_valid() is false. set(), update(), and callers passing this object to the C API must ensure is_valid() is true or check before use.
◆ Settings() [1/4]
| c2pa::Settings::Settings |
( |
| ) |
|
◆ Settings() [2/4]
| c2pa::Settings::Settings |
( |
const std::string & |
data, |
|
|
const std::string & |
format |
|
) |
| |
Create settings from a configuration string.
- Parameters
-
| data | Configuration data in JSON format. |
| format | Format of the data ("json"). |
- Exceptions
-
◆ Settings() [3/4]
| c2pa::Settings::Settings |
( |
Settings && |
| ) |
|
|
noexcept |
◆ Settings() [4/4]
| c2pa::Settings::Settings |
( |
const Settings & |
| ) |
|
|
delete |
◆ ~Settings()
| c2pa::Settings::~Settings |
( |
| ) |
|
|
noexcept |
◆ c_settings()
| C2paSettings * c2pa::Settings::c_settings |
( |
| ) |
const |
|
noexcept |
Get the raw C FFI settings pointer.
- Returns
- Pointer to C2paSettings when is_valid() is true; nullptr when invalid.
- Note
- Callers passing this to the C API should check is_valid() first and treat nullptr as invalid.
◆ is_valid()
| bool c2pa::Settings::is_valid |
( |
| ) |
const |
|
noexcept |
Check if this Settings object is valid (holds a C settings handle).
- Returns
- true if the object can be used (set, update, c_settings, or passed to Context/ContextBuilder).
-
false if moved-from (or otherwise invalid). Callers must check before use.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ set()
| Settings & c2pa::Settings::set |
( |
const std::string & |
path, |
|
|
const std::string & |
json_value |
|
) |
| |
Set a single configuration value by path.
- Parameters
-
| path | Dot-separated path to the setting (e.g., "verify.verify_after_sign"). |
| json_value | JSON-encoded value to set. |
- Returns
- Reference to this Settings for method chaining.
- Exceptions
-
◆ update() [1/2]
| Settings & c2pa::Settings::update |
( |
const std::string & |
data | ) |
|
|
inline |
Merge configuration from a JSON string (latest configuration wins).
- Parameters
-
| data | Configuration data in JSON format. |
- Returns
- Reference to this Settings for method chaining.
- Exceptions
-
- Note
- This is the recommended overload when configuration is JSON.
222{
return update(data,
"json"); }
Settings & update(const std::string &data)
Merge configuration from a JSON string (latest configuration wins).
Definition c2pa.hpp:222
◆ update() [2/2]
| Settings & c2pa::Settings::update |
( |
const std::string & |
data, |
|
|
const std::string & |
format |
|
) |
| |
Merge configuration from a std::string (latest configuration wins).
- Parameters
-
| data | Configuration data in JSON or TOML format. |
| format | Format of the data ("json" or "toml"). |
- Returns
- Reference to this Settings for method chaining.
- Exceptions
-
The documentation for this class was generated from the following file: