summaryrefslogtreecommitdiff
path: root/XMPCore/source/ClientDOMParserWrapperImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'XMPCore/source/ClientDOMParserWrapperImpl.cpp')
-rw-r--r--XMPCore/source/ClientDOMParserWrapperImpl.cpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/XMPCore/source/ClientDOMParserWrapperImpl.cpp b/XMPCore/source/ClientDOMParserWrapperImpl.cpp
new file mode 100644
index 0000000..b3bad60
--- /dev/null
+++ b/XMPCore/source/ClientDOMParserWrapperImpl.cpp
@@ -0,0 +1,90 @@
+// =================================================================================================
+// ADOBE SYSTEMS INCORPORATED
+// Copyright 2015 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.
+// =================================================================================================
+
+namespace AdobeXMPCore_Int {
+ class ClientDOMParserWrapperImpl;
+}
+
+#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore_Int::ClientDOMParserWrapperImpl;
+
+#define IMPLEMENTATION_HEADERS_CAN_BE_INCLUDED 1
+ #include "XMPCore/ImplHeaders/ClientDOMParserWrapperImpl.h"
+#undef IMPLEMENTATION_HEADERS_CAN_BE_INCLUDED
+
+#include "XMPCommon/Interfaces/IError_I.h"
+#include "XMPCore/XMPCoreErrorCodes.h"
+#include "XMPCore/Interfaces/IClientDOMParser.h"
+#include "XMPCommon/Utilities/TSmartPointers_I.h"
+#include "XMPCore/Interfaces/INode.h"
+
+namespace AdobeXMPCore_Int {
+
+
+ ClientDOMParserWrapperImpl::ClientDOMParserWrapperImpl( pIClientDOMParser_base parser )
+ : mpClientParser( parser )
+ {
+ if ( parser ) {
+ pcIError_base error( NULL );
+ uint32 unknownExceptionCaught( 0 );
+ TreatKeyAsCaseInsensitive( parser->areKeysCaseSensitive( error, unknownExceptionCaught ) == 0 );
+ if ( !error && unknownExceptionCaught == 0 )
+ parser->initialize( this, error, unknownExceptionCaught );
+ if ( error ) {
+ auto spError = IError::MakeShared( error );
+ error->Release();
+ throw spError;
+ }
+ if ( unknownExceptionCaught )
+ NOTIFY_ERROR( IError::kEDGeneral, kGECUnknownExceptionCaught, "Unknown Exception caught in the client code", IError::kESOperationFatal, false, false );
+ }
+ }
+
+ spINode APICALL ClientDOMParserWrapperImpl::ParseAsNode( const char * buffer, sizet bufferLength ) {
+ pcIError_base error( NULL );
+ uint32 unknownExceptionCaught( 0 );
+ auto pnode = mpClientParser->parse( buffer, bufferLength, this, &ReportErrorAndContinueABISafe, error, unknownExceptionCaught );
+ if ( error ) {
+ auto spError = IError::MakeShared( error );
+ error->Release();
+ throw spError;
+ }
+ if ( unknownExceptionCaught )
+ NOTIFY_ERROR( IError::kEDGeneral, kGECUnknownExceptionCaught, "Unknown Exception caught in the client code", IError::kESOperationFatal, false, false );
+ return MakeUncheckedSharedPointer( pnode, __FILE__, __LINE__, false );
+ }
+
+ ClientDOMParserWrapperImpl::~ClientDOMParserWrapperImpl() __NOTHROW__ {
+ if ( mpClientParser ) {
+ mpClientParser->Release();
+ mpClientParser = NULL;
+ }
+ }
+
+ eConfigurableErrorCode APICALL ClientDOMParserWrapperImpl::ValidateValue( const uint64 & key, eDataType type, const CombinedDataValue & value ) const {
+ pcIError_base error( NULL );
+ uint32 unknownExceptionCaught( 0 );
+ auto retValue = mpClientParser->validate( key, static_cast< uint32 >( type ), value, error, unknownExceptionCaught );
+ if ( error ) {
+ auto spError = IError::MakeShared( error );
+ error->Release();
+ throw spError;
+ }
+ if ( unknownExceptionCaught )
+ NOTIFY_ERROR( IError::kEDGeneral, kGECUnknownExceptionCaught, "Unknown Exception caught in the client code", IError::kESOperationFatal, false, false );
+ return static_cast< eConfigurableErrorCode >( retValue );
+ }
+
+ DOMParserImpl * APICALL ClientDOMParserWrapperImpl::clone() const {
+ ClientDOMParserWrapperImpl * cloned = new ClientDOMParserWrapperImpl( NULL );
+ if ( cloned )
+ cloned->mpClientParser = mpClientParser;
+ return cloned;
+ }
+
+}