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

Function SortWithinOffspring

xmpsdk/src/XMPMeta.cpp:549–580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

547// sorts the elements by value. If the node is an AltText array it sorts the elements by language.
548
549static void
550SortWithinOffspring ( XMP_NodeOffspring & nodeVec )
551{
552
553 for ( size_t i = 0, limit = nodeVec.size(); i < limit; ++i ) {
554
555 XMP_Node * currPos = nodeVec[i];
556
557 if ( ! currPos->qualifiers.empty() ) {
558 sort ( currPos->qualifiers.begin(), currPos->qualifiers.end(), CompareNodeNames );
559 SortWithinOffspring ( currPos->qualifiers );
560 }
561
562 if ( ! currPos->children.empty() ) {
563
564 if ( XMP_PropIsStruct ( currPos->options ) || XMP_NodeIsSchema ( currPos->options ) ) {
565 sort ( currPos->children.begin(), currPos->children.end(), CompareNodeNames );
566 } else if ( XMP_PropIsArray ( currPos->options ) ) {
567 if ( XMP_ArrayIsUnordered ( currPos->options ) ) {
568 stable_sort ( currPos->children.begin(), currPos->children.end(), CompareNodeValues );
569 } else if ( XMP_ArrayIsAltText ( currPos->options ) ) {
570 sort ( currPos->children.begin(), currPos->children.end(), CompareNodeLangs );
571 }
572 }
573
574 SortWithinOffspring ( currPos->children );
575
576 }
577
578 }
579
580} // SortWithinOffspring
581
582
583// =================================================================================================

Callers 1

SortMethod · 0.85

Calls 4

sizeMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected