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

Function RDF_NodeElementAttrs

xmpsdk/src/ParseRDF.cpp:729–774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727static const XMP_OptionBits kExclusiveAttrMask = (kRDFMask_ID | kRDFMask_nodeID | kRDFMask_about);
728
729static void
730RDF_NodeElementAttrs ( XMP_Node * xmpParent, const XML_Node & xmlNode, bool isTopLevel )
731{
732 XMP_OptionBits exclusiveAttrs = 0; // Used to detect attributes that are mutually exclusive.
733
734 XML_cNodePos currAttr = xmlNode.attrs.begin();
735 XML_cNodePos endAttr = xmlNode.attrs.end();
736
737 for ( ; currAttr != endAttr; ++currAttr ) {
738
739 RDFTermKind attrTerm = GetRDFTermKind ( (*currAttr)->name );
740
741 switch ( attrTerm ) {
742
743 case kRDFTerm_ID :
744 case kRDFTerm_nodeID :
745 case kRDFTerm_about :
746
747 if ( exclusiveAttrs & kExclusiveAttrMask ) XMP_Throw ( "Mutally exclusive about, ID, nodeID attributes", kXMPErr_BadRDF );
748 exclusiveAttrs |= (1 << attrTerm);
749
750 if ( isTopLevel && (attrTerm == kRDFTerm_about) ) {
751 // This is the rdf:about attribute on a top level node. Set the XMP tree name if
752 // it doesn't have a name yet. Make sure this name matches the XMP tree name.
753 XMP_Assert ( xmpParent->parent == 0 ); // Must be the tree root node.
754 if ( xmpParent->name.empty() ) {
755 xmpParent->name = (*currAttr)->value;
756 } else if ( ! (*currAttr)->value.empty() ) {
757 if ( xmpParent->name != (*currAttr)->value ) XMP_Throw ( "Mismatched top level rdf:about values", kXMPErr_BadXMP );
758 }
759 }
760
761 break;
762
763 case kRDFTerm_Other :
764 AddChildNode ( xmpParent, **currAttr, (*currAttr)->value.c_str(), isTopLevel );
765 break;
766
767 default :
768 XMP_Throw ( "Invalid nodeElement attribute", kXMPErr_BadRDF );
769
770 }
771
772 }
773
774} // RDF_NodeElementAttrs
775
776
777// =================================================================================================

Callers 1

RDF_NodeElementFunction · 0.85

Calls 6

GetRDFTermKindFunction · 0.85
AddChildNodeFunction · 0.85
c_strMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected