c2pa-c
C++ API for c2pa-c library
Loading...
Searching...
No Matches
c2pa.hpp File Reference

C++ wrapper for the C2PA C library. More...

#include <cerrno>
#include <filesystem>
#include <fstream>
#include <istream>
#include <ostream>
#include <string>
#include <vector>
#include <optional>
#include <memory>
#include <utility>
#include "c2pa.h"
Include dependency graph for c2pa.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  c2pa::C2paException
 Exception class for C2pa errors. This class is used to throw exceptions for errors encountered by the C2pa library via c2pa_error(). More...
 
class  c2pa::IContextProvider
 Interface for types that can provide C2PA context functionality. More...
 
class  c2pa::Settings
 (C2PA SDK) Settings configuration object for creating contexts. More...
 
class  c2pa::Context
 C2PA context implementing IContextProvider. More...
 
class  c2pa::Context::ContextBuilder
 ContextBuilder for creating customized Context instances. More...
 
class  c2pa::CppIStream
 Input stream IStream wrapper for C2paStream. More...
 
class  c2pa::CppOStream
 Output stream OStream wrapper for C2paStream. More...
 
class  c2pa::CppIOStream
 IOStream Class wrapper for C2paStream. More...
 
class  c2pa::Reader
 Reader class for reading a manifest. More...
 
class  c2pa::Signer
 Signer class for creating a Signer. More...
 
class  c2pa::Builder
 Builder class for creating a manifest. More...
 

Namespaces

namespace  c2pa
 

Macros

#define C2PA_CPP_API
 

Typedefs

typedef C2paSignerInfo c2pa::SignerInfo
 Type alias for C2paSignerInfo from the C API.
 
using c2pa::SignerFunc = std::vector< unsigned char >(const std::vector< unsigned char > &)
 Signer callback function type.
 

Enumerations

enum class  c2pa::OperationResult : int { c2pa::Success = 0 , c2pa::Error = -1 }
 Result codes for C API operations (matches C API return convention). More...
 
enum class  c2pa::StreamError : int { c2pa::InvalidArgument = EINVAL , c2pa::IoError = EIO , c2pa::NoBufferSpace = ENOBUFS }
 Stream/FFI error codes (maps to errno values used by the C layer). More...
 

Functions

int c2pa::stream_error_return (StreamError e) noexcept
 Set errno from StreamError and return error sentinel.
 
std::string c2pa::version ()
 Get the version of the C2PA library.
 
void c2pa::load_settings (const std::string &data, const std::string &format)
 Load C2PA settings from a string in a given format.
 
std::optional< std::string > c2pa::read_file (const std::filesystem::path &source_path, const std::optional< std::filesystem::path > data_dir=std::nullopt)
 Read a file and return the manifest JSON.
 
std::string c2pa::read_ingredient_file (const std::filesystem::path &source_path, const std::filesystem::path &data_dir)
 Read a file and return an ingredient JSON.
 
void c2pa::sign_file (const std::filesystem::path &source_path, const std::filesystem::path &dest_path, const char *manifest, SignerInfo *signer_info, const std::optional< std::filesystem::path > data_dir=std::nullopt)
 Add a manifest and sign a file.
 

Detailed Description

C++ wrapper for the C2PA C library.

This is used for creating and verifying C2PA manifests. This is an early version, and has not been fully tested. Thread safety is not guaranteed due to the use of errno and etc.

Macro Definition Documentation

◆ C2PA_CPP_API

#define C2PA_CPP_API