libart-paperback 0.1.0-a.1.20260122225059.e5fea306241a
PDF (1.4) library for C++
Art::Paperback::Carousel::File Class Reference

Represents a COS-format file. More...

#include <art/paperback/carousel/file.hxx>

Classes

struct  Create_new
 
struct  Internal
 COS-file internals. More...
 
struct  Revision
 Represents a COS-file revision. More...
 

Public Member Functions

 File (Create_new const &, iostream &, int, int, string)
 Constructor.
 
 ~File () noexcept
 Destructor.
 
Dictionarycatalog ()
 Access the COS-file catalog dictionary object.
 
Dictionaryinfo ()
 Access the COS-file info dictionary object.
 
template<typename T, typename... Args>
Object create_object (Args &&... args)
 Create a new object.
 
void commit_revision ()
 Commit the current COS-file revision to the output stream.
 

Static Public Attributes

static constexpr Create_new create_new {}
 Dispatch-tag for creating a new COS-file.
 

Private Member Functions

Object_model::Container_baseget_container (Identity const &)
 Get container.
 
Object_model::Container_base const & get_container (Identity const &) const
 Get container.
 
 File (File const &)=delete
 
 File (File &&)=delete
 
Fileoperator= (File const &)=delete
 
Fileoperator= (File &&)=delete
 
Identity allocate ()
 Allocates a new index.
 
void insert (Identity const &, shared_ptr< Object_model::Container_base >)
 Inserts an object into the cross-reference table.
 

Private Attributes

unique_ptr< Internalinternal
 

Detailed Description

Represents a COS-format file.

Object generations are not used for new files in the paperback implementation of the COS file format.

Newly allocated objects are always assigned the next available object index with a generation of 0.

Note though that paperback io support _enerations when opening an existing PDF file. That is, the index and generation will be used when looking up an object reference.

Constructor & Destructor Documentation

◆ File()

Art::Paperback::Carousel::File::File ( Create_new const & ,
iostream & ios,
int major,
int minor,
string header )

Constructor.

Creates a new COS-file.

The parameters major and minor correspond to the version of the PDF-document which the file represents.

Parameters
iosThe io stream for this COS-file.
majorThe major version of the document.
minorThe minor version of the document.
headerThe COS-file header, e.g. PDF-1.4.

◆ ~File()

Art::Paperback::Carousel::File::~File ( )
noexcept

Destructor.

This destructor will automatically commit the current revision, but any exceptions thrown during write will be ignored.

Member Function Documentation

◆ catalog()

Dictionary & Art::Paperback::Carousel::File::catalog ( )

Access the COS-file catalog dictionary object.

Returns
Returns a reference to the COS-file catalog dictionary.

◆ info()

Dictionary & Art::Paperback::Carousel::File::info ( )

Access the COS-file info dictionary object.

Returns
Returns a reference to the COS-file info dictionary.

◆ create_object()

template<typename T, typename... Args>
Object Art::Paperback::Carousel::File::create_object ( Args &&... args)
inline

Create a new object.

◆ commit_revision()

void Art::Paperback::Carousel::File::commit_revision ( )

Commit the current COS-file revision to the output stream.

Calling this function will write all objects in the current revision to the output stream.

A new revision will be created automatically.

All modified objects will be marked as clean.

◆ get_container() [1/2]

Object_model::Container_base & Art::Paperback::Carousel::File::get_container ( Identity const & identity)
private

Get container.

◆ get_container() [2/2]

Object_model::Container_base const & Art::Paperback::Carousel::File::get_container ( Identity const & identity) const
private

Get container.

◆ allocate()

Identity Art::Paperback::Carousel::File::allocate ( )
private

Allocates a new index.

Returns
Returns the allocated index.

◆ insert()

void Art::Paperback::Carousel::File::insert ( Identity const & identity,
shared_ptr< Object_model::Container_base > container )
private

Inserts an object into the cross-reference table.

Parameters
identityThe identity of the object.
containerThe container of the object.

Member Data Documentation

◆ create_new

Create_new Art::Paperback::Carousel::File::create_new {}
staticconstexpr

Dispatch-tag for creating a new COS-file.