Fesapi 2.10.1.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
Loading...
Searching...
No Matches
epc::Package Class Reference

#include <Package.h>

Public Member Functions

 Package ()
 
 Package (const Package &)=delete
 
 Package (const FileCoreProperties &pkgFileCP, const FileContentType &pkgFileCT, const FileRelationship &pkgFileRS, const PartMap &pkgFileP, const std::string &pkgPathName)
 
Packageoperator= (const Package &)=delete
 
 ~Package ()
 
void openForWriting (const std::string &pkgPathName, int append, bool useZip64=false)
 
bool isOpenedForWriting () const
 
std::vector< std::string > openForReading (const std::string &pkgPathName)
 
bool isOpenedForReading () const
 
void close ()
 
const FileCorePropertiesgetFileCoreProperties () const
 
const FileContentTypegetFileContentType () const
 
const FileRelationshipgetPrincipalRelationship () const
 
const PartMap & getAllFilePart () const
 
const std::string & getPathname () const
 
void setFileFileCoreProperties (const FileCoreProperties &pkgFileCP)
 
std::unordered_map< std::string, std::string > & getExtendedCoreProperty ()
 
void addProperty (const CoreProperty::TypeProperty &pkgTypeProperty, const std::string &pkgPropertyValue)
 
void setFileContentType (const FileContentType &pkgFileCT)
 
void addContentType (const ContentType &contentType)
 
void setPrincipalRelationship (const FileRelationship &pkgFileRS)
 
void addRelationship (const Relationship &relationship)
 
FilePartcreatePart (const std::string &inputContent, const std::string &outputPartPath)
 
const FilePartfindPart (const std::string &outputPartPath) const
 
bool fileExists (const std::string &filename) const
 
std::string extractFile (const std::string &filename)
 
void writePackage ()
 

Detailed Description

A package.

Constructor & Destructor Documentation

◆ Package() [1/2]

epc::Package::Package ( )

Create a Package with pathname.

◆ Package() [2/2]

epc::Package::Package ( const FileCoreProperties & pkgFileCP,
const FileContentType & pkgFileCT,
const FileRelationship & pkgFileRS,
const PartMap & pkgFileP,
const std::string & pkgPathName )

Create a Package with CoreProperties file, ContentType file, Relationship file, vector of Part file and pathname.

Parameters
pkgFileCPThe package file cp.
pkgFileCTThe package file ct.
pkgFileRSThe package file RS.
pkgFilePThe package file p.
pkgPathNameFull pathname of the package file.

◆ ~Package()

epc::Package::~Package ( )

Destructor : free memory allocated for the parts

Member Function Documentation

◆ addContentType()

void epc::Package::addContentType ( const ContentType & contentType)

add a ContentType in the ContentTypes file of package.

Parameters
contentTypeThe ContentType to add.

◆ addProperty()

void epc::Package::addProperty ( const CoreProperty::TypeProperty & pkgTypeProperty,
const std::string & pkgPropertyValue )

add a Property in the CoreProperties file of package.

Parameters
pkgTypePropertyThe type of the property to add.
pkgPropertyValueThe value of the property to add.

◆ addRelationship()

void epc::Package::addRelationship ( const Relationship & relationship)

add a Relationship in the Relationships file of package.

Parameters
relationshipRelationship file.

◆ close()

void epc::Package::close ( )

Close the package

◆ createPart()

FilePart * epc::Package::createPart ( const std::string & inputContent,
const std::string & outputPartPath )

Creates a part in the package and returns it. This part will be automatically destroy with the package.

Parameters
inputContentThe input content.
outputPartPathFull pathname of the output part file.
Returns
a new part.

◆ extractFile()

std::string epc::Package::extractFile ( const std::string & filename)

Extract the content of a given file from the zip file

Parameters
filenameFilename of the file.
password(Optional) The password.
Returns
The extracted file.

◆ fileExists()

bool epc::Package::fileExists ( const std::string & filename) const

Check that a given file exists in the zip file

Parameters
filenameFilename of the file.
Returns
True if it succeeds, false if it fails.

◆ findPart()

const FilePart * epc::Package::findPart ( const std::string & outputPartPath) const

Find a part corresponding to the given path

Parameters
outputPartPathFull pathname of the output part file.
Returns
Null if it fails, else the found part.

◆ getAllFilePart()

const PartMap & epc::Package::getAllFilePart ( ) const

vector of part file.

Returns
all file part.

◆ getExtendedCoreProperty()

std::unordered_map< std::string, std::string > & epc::Package::getExtendedCoreProperty ( )

Get in read/write access all the non standard core properties of this package All added non standard core properties will be stored in a single part which will be linked to the standard core properties part.

Returns
A map associating keys and values of the extended core properties.

◆ getFileContentType()

const FileContentType & epc::Package::getFileContentType ( ) const

Gets file content type

Returns
ContentType file.

◆ getFileCoreProperties()

const FileCoreProperties & epc::Package::getFileCoreProperties ( ) const

Gets file core properties

Returns
CoreProperties file.

◆ getPathname()

const std::string & epc::Package::getPathname ( ) const

Get a const string reference on the name of the package.

Returns
The pathname.

◆ getPrincipalRelationship()

const FileRelationship & epc::Package::getPrincipalRelationship ( ) const

Gets principal relationship

Returns
Relationship file.

◆ isOpenedForReading()

bool epc::Package::isOpenedForReading ( ) const

Check if the package is already opened for reading.

◆ isOpenedForWriting()

bool epc::Package::isOpenedForWriting ( ) const

Check if the package is already opened for writing.

◆ openForReading()

std::vector< std::string > epc::Package::openForReading ( const std::string & pkgPathName)

Open the package for reading purpose

Parameters
pkgPathNameFull pathname of the package file.
Returns
empty vector if nothing went wrong. Otherwise, return warnings.

◆ openForWriting()

void epc::Package::openForWriting ( const std::string & pkgPathName,
int append,
bool useZip64 = false )

Open the package for writing purpose

Parameters
pkgPathNamecontain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on an Unix computer "zlib/zlib113.zip".
appendif the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will add files in existing zip (be sure you don't add file that doesn't exist). Else an ovewrite or a creation of the file will be done. If the zipfile cannot be opened, an invalid_argument exception is thrown.
useZip64(Optional) True to use zip 64.

◆ setFileContentType()

void epc::Package::setFileContentType ( const FileContentType & pkgFileCT)

set the ContentTypes file.

Parameters
pkgFileCTThe ContentType file.

◆ setFileFileCoreProperties()

void epc::Package::setFileFileCoreProperties ( const FileCoreProperties & pkgFileCP)

set the CoreProperties file.

Parameters
pkgFileCPCoreProperties file.

◆ setPrincipalRelationship()

void epc::Package::setPrincipalRelationship ( const FileRelationship & pkgFileRS)

set the Relationships file.

Parameters
pkgFileRSRelationship file.

◆ writePackage()

void epc::Package::writePackage ( )

Writes the package


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