MyScript Interactive Ink SDK 4.3.0
Public Member Functions | List of all members
myscript::iink::ContentPackage Class Referenceabstract

#include <ContentPackage.h>

Public Member Functions

virtual ~ContentPackage ()=default
 
virtual void save ()=0
 
virtual void saveToTemp ()=0
 
virtual void saveAs (const String &fileName)=0
 
virtual int getPartCount () const noexcept=0
 
virtual std::shared_ptr< ContentPart > getPart (int index)=0
 
virtual std::shared_ptr< ContentPart > getPart (const String &id)=0
 
virtual int indexOfPart (std::shared_ptr< ContentPart > part)=0
 
virtual std::shared_ptr< ContentPart > createPart (const String &type)=0
 
virtual std::shared_ptr< ContentPart > createPart (const String &type, float width, float height)=0
 
virtual void removePart (std::shared_ptr< ContentPart > part)=0
 
virtual void movePart (int fromIndex, int toIndex)=0
 
virtual std::shared_ptr< ContentPart > clonePart (std::shared_ptr< ContentPart > part)=0
 
virtual void extractObject (const String &url, const String &fileName)=0
 
virtual std::shared_ptr< ParameterSet > getMetadata ()=0
 
virtual void setMetadata (std::shared_ptr< ParameterSet > parameters)=0
 
virtual String getPath ()=0
 

Detailed Description

A package stores the user content as a sorted collection of parts.

See also
ContentPart.

Constructor & Destructor Documentation

◆ ~ContentPackage()

virtual myscript::iink::ContentPackage::~ContentPackage ( )
virtualdefault

Member Function Documentation

◆ save()

virtual void myscript::iink::ContentPackage::save ( )
pure virtual

Saves all ongoing modifications made to this package.

Exceptions
std::runtime_errorwhen an I/O operation fails.

◆ saveToTemp()

virtual void myscript::iink::ContentPackage::saveToTemp ( )
pure virtual

Saves all ongoing modifications made to this package, to a temporary folder. This operation is faster than save().

Note
by default temporary folder is located in the same directory as this package, and named by appending -files to this package's name.
temporary folder location can be set via the content-package.temp-folder configuration property.
Exceptions
std::runtime_errorwhen an I/O operation fails.

◆ saveAs()

virtual void myscript::iink::ContentPackage::saveAs ( const String &  fileName)
pure virtual

Saves of all ongoing modifications made to this package, to a new file.

Parameters
fileNamethe new file name.
Exceptions
std::runtime_errorwhen an I/O operation fails.

◆ getPartCount()

virtual int myscript::iink::ContentPackage::getPartCount ( ) const
pure virtualnoexcept

Returns the number of parts in this package.

Returns
the part count.

◆ getPart() [1/2]

virtual std::shared_ptr< ContentPart > myscript::iink::ContentPackage::getPart ( int  index)
pure virtual

Returns the part at the specified index.

Parameters
indexthe index of the requested part.
Returns
the requested part.
Exceptions
std::out_of_rangewhen index is out of range.

◆ getPart() [2/2]

virtual std::shared_ptr< ContentPart > myscript::iink::ContentPackage::getPart ( const String &  id)
pure virtual

Returns the specified part.

Parameters
idthe identifier of the requested part.
Returns
the part.
Exceptions
std::invalid_argumentwhen no part is associated with identifier id.

◆ indexOfPart()

virtual int myscript::iink::ContentPackage::indexOfPart ( std::shared_ptr< ContentPart >  part)
pure virtual

Returns the index of a given part.

Parameters
partthe part.
Returns
the index of the part, or -1 when the part does not belong to this package.

◆ createPart() [1/2]

virtual std::shared_ptr< ContentPart > myscript::iink::ContentPackage::createPart ( const String &  type)
pure virtual

Appends a new part to this package.

Parameters
typethe type of part.
Returns
the newly created part.
Exceptions
std::invalid_argumentwhen type is not a valid ContentPart type.

◆ createPart() [2/2]

virtual std::shared_ptr< ContentPart > myscript::iink::ContentPackage::createPart ( const String &  type,
float  width,
float  height 
)
pure virtual
Warning
This is a Beta API.

Appends a new fixed-size part to this package.

Parameters
typethe type of part.
widththe width of the part (document coordinates in mm).
heightthe height of part (document coordinates in mm).
Returns
the newly created part.
Exceptions
std::invalid_argumentwhen type is not a Raw Content ContentPart type.
std::invalid_argumentwhen width or height are not a number or < 1.0.
Since
4.1

◆ removePart()

virtual void myscript::iink::ContentPackage::removePart ( std::shared_ptr< ContentPart >  part)
pure virtual

Removes the given part from this package.

Parameters
partthe part to remove.
Exceptions
std::invalid_argumentwhen part does not belong to this package.
Since
1.2

◆ movePart()

virtual void myscript::iink::ContentPackage::movePart ( int  fromIndex,
int  toIndex 
)
pure virtual

Moves the given part to another index.

Parameters
fromIndexthe current index of the requested part.
toIndexthe new index of the part.
Exceptions
std::out_of_rangewhen fromIndex is out of range.
std::out_of_rangewhen toIndex is out of range.
Since
2.1.1

◆ clonePart()

virtual std::shared_ptr< ContentPart > myscript::iink::ContentPackage::clonePart ( std::shared_ptr< ContentPart >  part)
pure virtual

Adds an existing part to this package.

Note
Part modifications that have not been saved (to temporary directory or to an actual package file) will not be imported.
The part can be an existing part from this package or from another open package.
Parameters
partthe part to clone into this package.
Returns
the newly created part.
Exceptions
std::invalid_argumentwhen part is not valid.
Since
1.2

◆ extractObject()

virtual void myscript::iink::ContentPackage::extractObject ( const String &  url,
const String &  fileName 
)
pure virtual

Extracts an object from this package to a given path.

Parameters
urlURL of the object.
fileNamedestination file.
Exceptions
std::invalid_argumentwhen no object named url exists.
std::runtime_errorwhen an I/O operation fails.

◆ getMetadata()

virtual std::shared_ptr< ParameterSet > myscript::iink::ContentPackage::getMetadata ( )
pure virtual

Returns this package's metadata as a parameter set.

Returns
the parameter set.

◆ setMetadata()

virtual void myscript::iink::ContentPackage::setMetadata ( std::shared_ptr< ParameterSet >  parameters)
pure virtual

Set this package's metadata with the given parameter set.

Parameters
parametersthe parameters to set.

◆ getPath()

virtual String myscript::iink::ContentPackage::getPath ( )
pure virtual

Returns the path of this package.

Returns
the path.
Since
2.0

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