c2pa-cpp v0.27.0
C++ API for the C2PA SDK
Loading...
Searching...
No Matches
c2pa::CppIStream Class Reference

Input stream IStream wrapper for C2paStream. More...

#include <c2pa.hpp>

Inheritance diagram for c2pa::CppIStream:
Collaboration diagram for c2pa::CppIStream:

Public Member Functions

template<typename IStream>
 CppIStream (IStream &istream)
 Construct an input stream wrapper from a std::istream-derived object.
 CppIStream (const CppIStream &)=delete
CppIStream & operator= (const CppIStream &)=delete
 CppIStream (CppIStream &&)=delete
CppIStream & operator= (CppIStream &&)=delete
 ~CppIStream () override
Public Member Functions inherited from c2pa::C2paStream
 C2paStream (const C2paStream &)=delete
C2paStream & operator= (const C2paStream &)=delete
 C2paStream (C2paStream &&)=delete
C2paStream & operator= (C2paStream &&)=delete
virtual ~C2paStream ()

Friends

class Reader

Additional Inherited Members

Public Attributes inherited from c2pa::C2paStream
::C2paStream * c_stream = nullptr
 Pointer to the underlying C2paStream.
Protected Member Functions inherited from c2pa::C2paStream
 C2paStream ()=default

Detailed Description

Input stream IStream wrapper for C2paStream.

This class is used to wrap an input stream for use with the C2PA library.

Constructor & Destructor Documentation

◆ CppIStream() [1/3]

template<typename IStream>
c2pa::CppIStream::CppIStream ( IStream & istream)
inlineexplicit

Construct an input stream wrapper from a std::istream-derived object.

Template Parameters
IStreamType derived from std::istream.
Parameters
istreamThe input stream to wrap (must be open and valid).
Exceptions
C2paExceptionif stream wrapper creation fails.
575 {
576 static_assert(std::is_base_of<std::istream, IStream>::value,
577 "Stream must be derived from std::istream");
578 // Upcast to std::istream* before type erasure; the callbacks cast the context back to std::istream*
579 c_stream = c2pa_create_stream(reinterpret_cast<StreamContext *>(static_cast<std::istream *>(&istream)), reader, seeker, writer, flusher);
580 if (c_stream == nullptr) {
581 throw C2paException("Failed to create input stream wrapper: is stream open and valid?");
582 }
583 }
::C2paStream * c_stream
Pointer to the underlying C2paStream.
Definition c2pa.hpp:552

◆ CppIStream() [2/3]

c2pa::CppIStream::CppIStream ( const CppIStream & )
delete

◆ CppIStream() [3/3]

c2pa::CppIStream::CppIStream ( CppIStream && )
delete

◆ ~CppIStream()

c2pa::CppIStream::~CppIStream ( )
override

Member Function Documentation

◆ operator=() [1/2]

CppIStream & c2pa::CppIStream::operator= ( const CppIStream & )
delete

◆ operator=() [2/2]

CppIStream & c2pa::CppIStream::operator= ( CppIStream && )
delete

◆ Reader

friend class Reader
friend

The documentation for this class was generated from the following file: