Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending API to query required namespaces #348

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Include/Model/COM/NMR_COMVersion.h
debug
.DS_Store
.vscode
.vs
57 changes: 54 additions & 3 deletions Autogenerated/Bindings/C/lib3mf.h
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_attachment_setrelationshiptype(Lib3MF_Attach
LIB3MF_DECLSPEC Lib3MFResult lib3mf_attachment_writetofile(Lib3MF_Attachment pAttachment, const char * pFileName);

/**
* 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 packege, or via the WriteToFile or WriteToBuffer-methods.
* 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.
*
* @param[in] pAttachment - Attachment instance.
* @param[in] pFileName - file to read from.
Expand All @@ -2056,7 +2056,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_attachment_writetofile(Lib3MF_Attachment pAt
LIB3MF_DECLSPEC Lib3MFResult lib3mf_attachment_readfromfile(Lib3MF_Attachment pAttachment, const char * pFileName);

/**
* Reads a model and from the data provided by a callback function
* 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.
*
* @param[in] pAttachment - Attachment instance.
* @param[in] pTheReadCallback - Callback to call for reading a data chunk
Expand Down Expand Up @@ -2088,7 +2088,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_attachment_getstreamsize(Lib3MF_Attachment p
LIB3MF_DECLSPEC Lib3MFResult lib3mf_attachment_writetobuffer(Lib3MF_Attachment pAttachment, const Lib3MF_uint64 nBufferBufferSize, Lib3MF_uint64* pBufferNeededCount, Lib3MF_uint8 * pBufferBuffer);

/**
* Reads an attachment from a memory buffer
* Reads an attachment from a memory buffer. This buffer is immediatly read (in contrast to the ReadFromCallback and ReadFromFile-methods).
*
* @param[in] pAttachment - Attachment instance.
* @param[in] nBufferBufferSize - Number of elements in buffer
Expand Down Expand Up @@ -2954,6 +2954,48 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_keystore_getuuid(Lib3MF_KeyStore pKeyStore,
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_keystore_setuuid(Lib3MF_KeyStore pKeyStore, const char * pUUID);

/*************************************************************************************************************************
Class definition for NameSpaceIterator
**************************************************************************************************************************/

/**
* Iterates to the next namespace in the list.
*
* @param[in] pNameSpaceIterator - NameSpaceIterator instance.
* @param[out] pHasNext - Iterates to the namespace in the list.
* @return error code or 0 (success)
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_namespaceiterator_movenext(Lib3MF_NameSpaceIterator pNameSpaceIterator, bool * pHasNext);

/**
* Iterates to the previous namespace in the list.
*
* @param[in] pNameSpaceIterator - NameSpaceIterator instance.
* @param[out] pHasPrevious - Iterates to the previous required namespace in the list.
* @return error code or 0 (success)
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_namespaceiterator_moveprevious(Lib3MF_NameSpaceIterator pNameSpaceIterator, bool * pHasPrevious);

/**
* Returns the required namespace the iterator points at.
*
* @param[in] pNameSpaceIterator - NameSpaceIterator instance.
* @param[in] nNameSpaceBufferSize - size of the buffer (including trailing 0)
* @param[out] pNameSpaceNeededChars - will be filled with the count of the written bytes, or needed buffer size.
* @param[out] pNameSpaceBuffer - buffer of returns the namespace., may be NULL
* @return error code or 0 (success)
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_namespaceiterator_getcurrent(Lib3MF_NameSpaceIterator pNameSpaceIterator, const Lib3MF_uint32 nNameSpaceBufferSize, Lib3MF_uint32* pNameSpaceNeededChars, char * pNameSpaceBuffer);

/**
* Returns the number of namespaces the iterator captures.
*
* @param[in] pNameSpaceIterator - NameSpaceIterator instance.
* @param[out] pCount - returns the number of namspaces the iterator captures.
* @return error code or 0 (success)
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_namespaceiterator_count(Lib3MF_NameSpaceIterator pNameSpaceIterator, Lib3MF_uint64 * pCount);

/*************************************************************************************************************************
Class definition for Model
**************************************************************************************************************************/
Expand Down Expand Up @@ -3528,6 +3570,15 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_setrandomnumbercallback(Lib3MF_Model p
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_getkeystore(Lib3MF_Model pModel, Lib3MF_KeyStore * pKeyStore);

/**
* Gets the list of required namespaces for the model
*
* @param[in] pModel - Model instance.
* @param[out] pNameSpaceIterator - The required namespace iterator
* @return error code or 0 (success)
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_getrequirednamespaces(Lib3MF_Model pModel, Lib3MF_NameSpaceIterator * pNameSpaceIterator);

/*************************************************************************************************************************
Global functions
**************************************************************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions Autogenerated/Bindings/C/lib3mf_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ typedef Lib3MFHandle Lib3MF_ContentEncryptionParams;
typedef Lib3MFHandle Lib3MF_ResourceData;
typedef Lib3MFHandle Lib3MF_ResourceDataGroup;
typedef Lib3MFHandle Lib3MF_KeyStore;
typedef Lib3MFHandle Lib3MF_NameSpaceIterator;
typedef Lib3MFHandle Lib3MF_Model;

/*************************************************************************************************************************
Expand Down
50 changes: 50 additions & 0 deletions Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable)
pWrapperTable->m_KeyStore_GetResourceData = NULL;
pWrapperTable->m_KeyStore_GetUUID = NULL;
pWrapperTable->m_KeyStore_SetUUID = NULL;
pWrapperTable->m_NameSpaceIterator_MoveNext = NULL;
pWrapperTable->m_NameSpaceIterator_MovePrevious = NULL;
pWrapperTable->m_NameSpaceIterator_GetCurrent = NULL;
pWrapperTable->m_NameSpaceIterator_Count = NULL;
pWrapperTable->m_Model_RootModelPart = NULL;
pWrapperTable->m_Model_FindOrCreatePackagePart = NULL;
pWrapperTable->m_Model_SetUnit = NULL;
Expand Down Expand Up @@ -388,6 +392,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable)
pWrapperTable->m_Model_RemoveCustomContentType = NULL;
pWrapperTable->m_Model_SetRandomNumberCallback = NULL;
pWrapperTable->m_Model_GetKeyStore = NULL;
pWrapperTable->m_Model_GetRequiredNameSpaces = NULL;
pWrapperTable->m_GetLibraryVersion = NULL;
pWrapperTable->m_GetPrereleaseInformation = NULL;
pWrapperTable->m_GetBuildInformation = NULL;
Expand Down Expand Up @@ -2981,6 +2986,42 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable,
if (pWrapperTable->m_KeyStore_SetUUID == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_NameSpaceIterator_MoveNext = (PLib3MFNameSpaceIterator_MoveNextPtr) GetProcAddress(hLibrary, "lib3mf_namespaceiterator_movenext");
#else // _WIN32
pWrapperTable->m_NameSpaceIterator_MoveNext = (PLib3MFNameSpaceIterator_MoveNextPtr) dlsym(hLibrary, "lib3mf_namespaceiterator_movenext");
dlerror();
#endif // _WIN32
if (pWrapperTable->m_NameSpaceIterator_MoveNext == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_NameSpaceIterator_MovePrevious = (PLib3MFNameSpaceIterator_MovePreviousPtr) GetProcAddress(hLibrary, "lib3mf_namespaceiterator_moveprevious");
#else // _WIN32
pWrapperTable->m_NameSpaceIterator_MovePrevious = (PLib3MFNameSpaceIterator_MovePreviousPtr) dlsym(hLibrary, "lib3mf_namespaceiterator_moveprevious");
dlerror();
#endif // _WIN32
if (pWrapperTable->m_NameSpaceIterator_MovePrevious == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_NameSpaceIterator_GetCurrent = (PLib3MFNameSpaceIterator_GetCurrentPtr) GetProcAddress(hLibrary, "lib3mf_namespaceiterator_getcurrent");
#else // _WIN32
pWrapperTable->m_NameSpaceIterator_GetCurrent = (PLib3MFNameSpaceIterator_GetCurrentPtr) dlsym(hLibrary, "lib3mf_namespaceiterator_getcurrent");
dlerror();
#endif // _WIN32
if (pWrapperTable->m_NameSpaceIterator_GetCurrent == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_NameSpaceIterator_Count = (PLib3MFNameSpaceIterator_CountPtr) GetProcAddress(hLibrary, "lib3mf_namespaceiterator_count");
#else // _WIN32
pWrapperTable->m_NameSpaceIterator_Count = (PLib3MFNameSpaceIterator_CountPtr) dlsym(hLibrary, "lib3mf_namespaceiterator_count");
dlerror();
#endif // _WIN32
if (pWrapperTable->m_NameSpaceIterator_Count == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_Model_RootModelPart = (PLib3MFModel_RootModelPartPtr) GetProcAddress(hLibrary, "lib3mf_model_rootmodelpart");
#else // _WIN32
Expand Down Expand Up @@ -3521,6 +3562,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable,
if (pWrapperTable->m_Model_GetKeyStore == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_Model_GetRequiredNameSpaces = (PLib3MFModel_GetRequiredNameSpacesPtr) GetProcAddress(hLibrary, "lib3mf_model_getrequirednamespaces");
#else // _WIN32
pWrapperTable->m_Model_GetRequiredNameSpaces = (PLib3MFModel_GetRequiredNameSpacesPtr) dlsym(hLibrary, "lib3mf_model_getrequirednamespaces");
dlerror();
#endif // _WIN32
if (pWrapperTable->m_Model_GetRequiredNameSpaces == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_GetLibraryVersion = (PLib3MFGetLibraryVersionPtr) GetProcAddress(hLibrary, "lib3mf_getlibraryversion");
#else // _WIN32
Expand Down
62 changes: 59 additions & 3 deletions Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ typedef Lib3MFResult (*PLib3MFAttachment_SetRelationShipTypePtr) (Lib3MF_Attachm
typedef Lib3MFResult (*PLib3MFAttachment_WriteToFilePtr) (Lib3MF_Attachment pAttachment, const char * pFileName);

/**
* 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 packege, or via the WriteToFile or WriteToBuffer-methods.
* 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.
*
* @param[in] pAttachment - Attachment instance.
* @param[in] pFileName - file to read from.
Expand All @@ -2043,7 +2043,7 @@ typedef Lib3MFResult (*PLib3MFAttachment_WriteToFilePtr) (Lib3MF_Attachment pAtt
typedef Lib3MFResult (*PLib3MFAttachment_ReadFromFilePtr) (Lib3MF_Attachment pAttachment, const char * pFileName);

/**
* Reads a model and from the data provided by a callback function
* 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.
*
* @param[in] pAttachment - Attachment instance.
* @param[in] pTheReadCallback - Callback to call for reading a data chunk
Expand Down Expand Up @@ -2075,7 +2075,7 @@ typedef Lib3MFResult (*PLib3MFAttachment_GetStreamSizePtr) (Lib3MF_Attachment pA
typedef Lib3MFResult (*PLib3MFAttachment_WriteToBufferPtr) (Lib3MF_Attachment pAttachment, const Lib3MF_uint64 nBufferBufferSize, Lib3MF_uint64* pBufferNeededCount, Lib3MF_uint8 * pBufferBuffer);

/**
* Reads an attachment from a memory buffer
* Reads an attachment from a memory buffer. This buffer is immediatly read (in contrast to the ReadFromCallback and ReadFromFile-methods).
*
* @param[in] pAttachment - Attachment instance.
* @param[in] nBufferBufferSize - Number of elements in buffer
Expand Down Expand Up @@ -2941,6 +2941,48 @@ typedef Lib3MFResult (*PLib3MFKeyStore_GetUUIDPtr) (Lib3MF_KeyStore pKeyStore, b
*/
typedef Lib3MFResult (*PLib3MFKeyStore_SetUUIDPtr) (Lib3MF_KeyStore pKeyStore, const char * pUUID);

/*************************************************************************************************************************
Class definition for NameSpaceIterator
**************************************************************************************************************************/

/**
* Iterates to the next namespace in the list.
*
* @param[in] pNameSpaceIterator - NameSpaceIterator instance.
* @param[out] pHasNext - Iterates to the namespace in the list.
* @return error code or 0 (success)
*/
typedef Lib3MFResult (*PLib3MFNameSpaceIterator_MoveNextPtr) (Lib3MF_NameSpaceIterator pNameSpaceIterator, bool * pHasNext);

/**
* Iterates to the previous namespace in the list.
*
* @param[in] pNameSpaceIterator - NameSpaceIterator instance.
* @param[out] pHasPrevious - Iterates to the previous required namespace in the list.
* @return error code or 0 (success)
*/
typedef Lib3MFResult (*PLib3MFNameSpaceIterator_MovePreviousPtr) (Lib3MF_NameSpaceIterator pNameSpaceIterator, bool * pHasPrevious);

/**
* Returns the required namespace the iterator points at.
*
* @param[in] pNameSpaceIterator - NameSpaceIterator instance.
* @param[in] nNameSpaceBufferSize - size of the buffer (including trailing 0)
* @param[out] pNameSpaceNeededChars - will be filled with the count of the written bytes, or needed buffer size.
* @param[out] pNameSpaceBuffer - buffer of returns the namespace., may be NULL
* @return error code or 0 (success)
*/
typedef Lib3MFResult (*PLib3MFNameSpaceIterator_GetCurrentPtr) (Lib3MF_NameSpaceIterator pNameSpaceIterator, const Lib3MF_uint32 nNameSpaceBufferSize, Lib3MF_uint32* pNameSpaceNeededChars, char * pNameSpaceBuffer);

/**
* Returns the number of namespaces the iterator captures.
*
* @param[in] pNameSpaceIterator - NameSpaceIterator instance.
* @param[out] pCount - returns the number of namspaces the iterator captures.
* @return error code or 0 (success)
*/
typedef Lib3MFResult (*PLib3MFNameSpaceIterator_CountPtr) (Lib3MF_NameSpaceIterator pNameSpaceIterator, Lib3MF_uint64 * pCount);

/*************************************************************************************************************************
Class definition for Model
**************************************************************************************************************************/
Expand Down Expand Up @@ -3515,6 +3557,15 @@ typedef Lib3MFResult (*PLib3MFModel_SetRandomNumberCallbackPtr) (Lib3MF_Model pM
*/
typedef Lib3MFResult (*PLib3MFModel_GetKeyStorePtr) (Lib3MF_Model pModel, Lib3MF_KeyStore * pKeyStore);

/**
* Gets the list of required namespaces for the model
*
* @param[in] pModel - Model instance.
* @param[out] pNameSpaceIterator - The required namespace iterator
* @return error code or 0 (success)
*/
typedef Lib3MFResult (*PLib3MFModel_GetRequiredNameSpacesPtr) (Lib3MF_Model pModel, Lib3MF_NameSpaceIterator * pNameSpaceIterator);

/*************************************************************************************************************************
Global functions
**************************************************************************************************************************/
Expand Down Expand Up @@ -3999,6 +4050,10 @@ typedef struct {
PLib3MFKeyStore_GetResourceDataPtr m_KeyStore_GetResourceData;
PLib3MFKeyStore_GetUUIDPtr m_KeyStore_GetUUID;
PLib3MFKeyStore_SetUUIDPtr m_KeyStore_SetUUID;
PLib3MFNameSpaceIterator_MoveNextPtr m_NameSpaceIterator_MoveNext;
PLib3MFNameSpaceIterator_MovePreviousPtr m_NameSpaceIterator_MovePrevious;
PLib3MFNameSpaceIterator_GetCurrentPtr m_NameSpaceIterator_GetCurrent;
PLib3MFNameSpaceIterator_CountPtr m_NameSpaceIterator_Count;
PLib3MFModel_RootModelPartPtr m_Model_RootModelPart;
PLib3MFModel_FindOrCreatePackagePartPtr m_Model_FindOrCreatePackagePart;
PLib3MFModel_SetUnitPtr m_Model_SetUnit;
Expand Down Expand Up @@ -4059,6 +4114,7 @@ typedef struct {
PLib3MFModel_RemoveCustomContentTypePtr m_Model_RemoveCustomContentType;
PLib3MFModel_SetRandomNumberCallbackPtr m_Model_SetRandomNumberCallback;
PLib3MFModel_GetKeyStorePtr m_Model_GetKeyStore;
PLib3MFModel_GetRequiredNameSpacesPtr m_Model_GetRequiredNameSpaces;
PLib3MFGetLibraryVersionPtr m_GetLibraryVersion;
PLib3MFGetPrereleaseInformationPtr m_GetPrereleaseInformation;
PLib3MFGetBuildInformationPtr m_GetBuildInformation;
Expand Down
1 change: 1 addition & 0 deletions Autogenerated/Bindings/CDynamic/lib3mf_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ typedef Lib3MFHandle Lib3MF_ContentEncryptionParams;
typedef Lib3MFHandle Lib3MF_ResourceData;
typedef Lib3MFHandle Lib3MF_ResourceDataGroup;
typedef Lib3MFHandle Lib3MF_KeyStore;
typedef Lib3MFHandle Lib3MF_NameSpaceIterator;
typedef Lib3MFHandle Lib3MF_Model;

/*************************************************************************************************************************
Expand Down
Loading
Loading