CAttachment

class Lib3MF::CAttachment : public CBase
std::string GetPath()

Retrieves an attachment’s package path. This function will be removed in a later release.

Returns:

returns the attachment’s package path string

void SetPath(const std::string &sPath)

Sets an attachment’s package path. This function will be removed in a later release.

Parameters:

sPath – new path of the attachment.

PPackagePart PackagePart()

Returns the PackagePart that is this attachment.

Returns:

The PackagePart of this attachment.

std::string GetRelationShipType()

Retrieves an attachment’s relationship type

Returns:

returns the attachment’s package relationship type string

void SetRelationShipType(const std::string &sPath)

Sets an attachment’s relationship type.

Parameters:

sPath – new relationship type string.

void WriteToFile(const std::string &sFileName)

Writes out the attachment as file.

Parameters:

sFileName – file to write into.

void ReadFromFile(const std::string &sFileName)

Reads an attachment from a file. The path of this file is only read when this attachment is being written as part of the 3MF package, or via the WriteToFile or WriteToBuffer methods.

Parameters:

sFileName – file to read from.

void ReadFromCallback(const ReadCallback pTheReadCallback, const Lib3MF_uint64 nStreamSize, const SeekCallback pTheSeekCallback, const Lib3MF_pvoid pUserData)

Reads an attachment from the data provided by a callback function. This callback function is only invoked when this attachment is being written as part of the 3MF package, or via the WriteToFile or WriteToBuffer methods.

Parameters:
  • pTheReadCallback – Callback to call for reading a data chunk

  • nStreamSize – number of bytes the callback returns

  • pTheSeekCallback – Callback to call for seeking in the stream.

  • pUserData – Userdata that is passed to the callback function

Lib3MF_uint64 GetStreamSize()

Retrieves the size of the attachment stream

Returns:

the stream size

void WriteToBuffer(std::vector<Lib3MF_uint8> &BufferBuffer)

Writes out the attachment into a buffer

Parameters:

BufferBuffer – Buffer to write into

void ReadFromBuffer(const CInputVector<Lib3MF_uint8> &BufferBuffer)

Reads an attachment from a memory buffer. This buffer is immediately read (in contrast to the ReadFromCallback and ReadFromFile-methods).

Parameters:

BufferBuffer – Buffer to read from

typedef std::shared_ptr<CAttachment> Lib3MF::PAttachment

Shared pointer to CAttachment to easily allow reference counting.