CReader

class Lib3MF::CReader : public CBase
void ReadFromFile(const std::string &sFilename)

Reads a model from a file. The file type is specified by the Model Reader class

Parameters

sFilename – Filename to read from

void ReadFromBuffer(const CInputVector<Lib3MF_uint8> &BufferBuffer)

Reads a model from a memory buffer.

Parameters

BufferBuffer – Buffer to read from

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

Reads a model and from the data provided by a callback function

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

void SetProgressCallback(const ProgressCallback pProgressCallback, const Lib3MF_pvoid pUserData)

Set the progress callback for calls to this writer

Parameters
  • pProgressCallback – pointer to the callback function.

  • pUserData – pointer to arbitrary user data that is passed without modification to the callback.

void AddRelationToRead(const std::string &sRelationShipType)

Adds a relationship type which shall be read as attachment in memory while loading

Parameters

sRelationShipType – String of the relationship type

void RemoveRelationToRead(const std::string &sRelationShipType)

Removes a relationship type which shall be read as attachment in memory while loading

Parameters

sRelationShipType – String of the relationship type

void SetStrictModeActive(const bool bStrictModeActive)

Activates (deactivates) the strict mode of the reader.

Parameters

bStrictModeActive – flag whether strict mode is active or not.

bool GetStrictModeActive()

Queries whether the strict mode of the reader is active or not

Returns

returns flag whether strict mode is active or not.

std::string GetWarning(const Lib3MF_uint32 nIndex, Lib3MF_uint32 &nErrorCode)

Returns Warning and Error Information of the read process

Parameters
  • nIndex – Index of the Warning. Valid values are 0 to WarningCount - 1

  • nErrorCode – filled with the error code of the warning

Returns

the message of the warning

Lib3MF_uint32 GetWarningCount()

Returns Warning and Error Count of the read process

Returns

filled with the count of the occurred warnings.

void AddKeyWrappingCallback(const std::string &sConsumerID, const KeyWrappingCallback pTheCallback, const Lib3MF_pvoid pUserData)

Registers a callback to deal with key wrapping mechanism from keystore

Parameters
  • sConsumerID – The ConsumerID to register for

  • pTheCallback – The callback used to decrypt data key

  • pUserData – Userdata that is passed to the callback function

void SetContentEncryptionCallback(const ContentEncryptionCallback pTheCallback, const Lib3MF_pvoid pUserData)

Registers a callback to deal with encryption of content

Parameters
  • pTheCallback – The callback used to encrypt content

  • pUserData – Userdata that is passed to the callback function

typedef std::shared_ptr<CReader> Lib3MF::PReader

Shared pointer to CReader to easily allow reference counting.