MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / DumpNamespaces

Method DumpNamespaces

xmpsdk/src/XMPMeta.cpp:879–946  ·  view source on GitHub ↗

class-static */

Source from the content-addressed store, hash-verified

877// *** Should put checks in a separate routine for regular calling in debug builds.
878
879/* class-static */ XMP_Status
880XMPMeta::DumpNamespaces ( XMP_TextOutputProc outProc,
881 void * refCon )
882{
883 XMP_Assert ( outProc != 0 ); // ! Enforced by wrapper.
884 XMP_Status status = 0;
885
886 XMP_StringMapPos p2uEnd = sNamespacePrefixToURIMap->end(); // ! Move up to avoid gcc complaints.
887 XMP_StringMapPos u2pEnd = sNamespaceURIToPrefixMap->end();
888
889 status = DumpStringMap ( *sNamespacePrefixToURIMap, "Dumping namespace prefix to URI map", outProc, refCon );
890 if ( status != 0 ) goto EXIT;
891
892 if ( sNamespacePrefixToURIMap->size() != sNamespaceURIToPrefixMap->size() ) {
893 OutProcLiteral ( "** bad namespace map sizes **" );
894 XMP_Throw ( "Fatal namespace map problem", kXMPErr_InternalFailure );
895 }
896
897 for ( XMP_StringMapPos nsLeft = sNamespacePrefixToURIMap->begin(); nsLeft != p2uEnd; ++nsLeft ) {
898
899 XMP_StringMapPos nsOther = sNamespaceURIToPrefixMap->find ( nsLeft->second );
900 if ( (nsOther == u2pEnd) || (nsLeft != sNamespacePrefixToURIMap->find ( nsOther->second )) ) {
901 OutProcLiteral ( " ** bad namespace URI ** " );
902 DumpClearString ( nsLeft->second, outProc, refCon );
903 goto FAILURE;
904 }
905
906 for ( XMP_StringMapPos nsRight = nsLeft; nsRight != p2uEnd; ++nsRight ) {
907 if ( nsRight == nsLeft ) continue; // ! Can't start at nsLeft+1, no operator+!
908 if ( nsLeft->second == nsRight->second ) {
909 OutProcLiteral ( " ** duplicate namespace URI ** " );
910 DumpClearString ( nsLeft->second, outProc, refCon );
911 goto FAILURE;
912 }
913 }
914
915 }
916
917 for ( XMP_StringMapPos nsLeft = sNamespaceURIToPrefixMap->begin(); nsLeft != u2pEnd; ++nsLeft ) {
918
919 XMP_StringMapPos nsOther = sNamespacePrefixToURIMap->find ( nsLeft->second );
920 if ( (nsOther == p2uEnd) || (nsLeft != sNamespaceURIToPrefixMap->find ( nsOther->second )) ) {
921 OutProcLiteral ( " ** bad namespace prefix ** " );
922 DumpClearString ( nsLeft->second, outProc, refCon );
923 goto FAILURE;
924 }
925
926 for ( XMP_StringMapPos nsRight = nsLeft; nsRight != u2pEnd; ++nsRight ) {
927 if ( nsRight == nsLeft ) continue; // ! Can't start at nsLeft+1, no operator+!
928 if ( nsLeft->second == nsRight->second ) {
929 OutProcLiteral ( " ** duplicate namespace prefix ** " );
930 DumpClearString ( nsLeft->second, outProc, refCon );
931 goto FAILURE;
932 }
933 }
934
935 }
936

Callers

nothing calls this directly

Calls 5

DumpStringMapFunction · 0.85
DumpClearStringFunction · 0.85
endMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected