diff options
Diffstat (limited to 'XMPCommon/source/ErrorNotifierWrapperImpl.cpp')
-rw-r--r-- | XMPCommon/source/ErrorNotifierWrapperImpl.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/XMPCommon/source/ErrorNotifierWrapperImpl.cpp b/XMPCommon/source/ErrorNotifierWrapperImpl.cpp new file mode 100644 index 0000000..e1ada62 --- /dev/null +++ b/XMPCommon/source/ErrorNotifierWrapperImpl.cpp @@ -0,0 +1,46 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCommon/XMPCommonFwdDeclarations_I.h" +namespace XMP_COMPONENT_INT_NAMESPACE { + class ErrorNotifierWrapperImpl_v1; +} +#define FRIEND_CLASS_DECLARATION() friend class XMP_COMPONENT_INT_NAMESPACE::ErrorNotifierWrapperImpl_v1; +#define IMPLEMENTATION_HEADERS_CAN_BE_INCLUDED 1 + #include "XMPCommon/ImplHeaders/ErrorNotifierWrapperImpl.h" +#undef IMPLEMENTATION_HEADERS_CAN_BE_INCLUDED +#undef FRIEND_CLASS_DECLARATION + +#include "XMPCommon/Utilities/TWrapperFunctions_I.h" + +namespace XMP_COMPONENT_INT_NAMESPACE { + + bool APICALL ErrorNotifierWrapperImpl_v1::Notify( const spcIError & err ) { + uint32 exceptionCaught( 0 ); + uint32 returnValue = mErrorNotifier->notify( err.get(), exceptionCaught ); + if ( exceptionCaught ) { + return false; + } + return returnValue != 0 ? true : false; + } + + ErrorNotifierWrapperImpl_v1::ErrorNotifierWrapperImpl_v1( IErrorNotifier_v1 * errorNotifier ) + : mErrorNotifier( errorNotifier ) {} + + pIErrorNotifier CreateErrorNotifierWrapperImpl( pIErrorNotifier_base errorNotifier ) { + if ( errorNotifier == NULL ) + return NULL; + // start with the highest available version and keep on going down + if ( IErrorNotifier_v1 * ptr = dynamic_cast< IErrorNotifier_v1 * >( errorNotifier ) ) { + return new ErrorNotifierWrapperImpl_v1( errorNotifier ); + } else { + return NULL; + } + } +} |