Files
2025-12-15 22:10:55 +08:00

73 lines
2.4 KiB
C++

/***********************************************************************************************************************
*
* Copyright (c) 2010 - 2022 by Tech Soft 3D, Inc.
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
* scope and manner of such use.
*
***********************************************************************************************************************/
/**
\file common.h
Definitions of macros, data and functions common to Publish samples.
This header requires prior inclusion of <A3DSDKIncludes.h>.
**/
#ifndef PUBLISH_SAMPLES_COMMONINIT_HPP
#define PUBLISH_SAMPLES_COMMONINIT_HPP
//######################################################################################################################
// The resource directory must be provided relative to the A3DLibs.dll binary directory
class A3DSDKHOOPSPublishLoader : public A3DSDKHOOPSExchangeLoader
{
public:
#ifdef _MSC_VER
A3DSDKHOOPSPublishLoader(const TCHAR* pcLibraryPath) :
A3DSDKHOOPSExchangeLoader(pcLibraryPath), m_bPDFLibLoaded(false) {};
#else
A3DSDKHOOPSPublishLoader(const A3DUTF8Char* pcLibraryPath, bool bDisableHandlingSIGSEGV = false) :
A3DSDKHOOPSExchangeLoader(pcLibraryPath, bDisableHandlingSIGSEGV), m_bPDFLibLoaded(false) {};
#endif
~A3DSDKHOOPSPublishLoader() { TerminatePDFLib(); };
#ifdef _MSC_VER
A3DStatus InitPDFLib()
#else
A3DStatus InitPDFLib()
#endif
{
A3DStatus iRet = A3D_ERROR;
A3DBool bIsInitialized = A3D_FALSE;
// check PDF library initialization
iRet = A3DPDFCheckPDFLibInitialization(&bIsInitialized);
if (iRet == A3D_SUCCESS && !bIsInitialized)
{
iRet = A3DPDFInitializePDFLibAndResourceDirectory(SAMPLES_ADOBE_RESOURCE_DIRECTORY);
m_bPDFLibLoaded = (iRet == A3D_SUCCESS);
}
return iRet;
};
void TerminatePDFLib()
{
// always terminate PDF library
if (m_bPDFLibLoaded)
A3DPDFTerminatePDFLib();
}
public:
bool m_bPDFLibLoaded;
};
//######################################################################################################################
#endif // PUBLISH_SAMPLES_COMMONINIT_HPP