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

Method ComposeStructFieldPath

xmpsdk/src/XMPUtils.cpp:744–774  ·  view source on GitHub ↗

class static */

Source from the content-addressed store, hash-verified

742// Return "structName/ns:fieldName".
743
744/* class static */ void
745XMPUtils::ComposeStructFieldPath ( XMP_StringPtr schemaNS,
746 XMP_StringPtr structName,
747 XMP_StringPtr fieldNS,
748 XMP_StringPtr fieldName,
749 XMP_StringPtr * fullPath,
750 XMP_StringLen * pathSize )
751{
752 XMP_Assert ( (schemaNS != 0) && (fieldNS != 0) ); // Enforced by wrapper.
753 XMP_Assert ( (*structName != 0) && (*fieldName != 0) ); // Enforced by wrapper.
754 XMP_Assert ( (fullPath != 0) && (pathSize != 0) ); // Enforced by wrapper.
755
756 XMP_ExpandedXPath expPath; // Just for side effects to check namespace and basic path.
757 ExpandXPath ( schemaNS, structName, &expPath );
758
759 XMP_ExpandedXPath fieldPath;
760 ExpandXPath ( fieldNS, fieldName, &fieldPath );
761 if ( fieldPath.size() != 2 ) XMP_Throw ( "The fieldName must be simple", kXMPErr_BadXPath );
762
763 XMP_StringLen reserveLen = strlen(structName) + fieldPath[kRootPropStep].step.size() + 1;
764
765 sComposedPath->erase();
766 sComposedPath->reserve ( reserveLen );
767 *sComposedPath = structName;
768 *sComposedPath += '/';
769 *sComposedPath += fieldPath[kRootPropStep].step;
770
771 *fullPath = sComposedPath->c_str();
772 *pathSize = sComposedPath->size();
773
774} // ComposeStructFieldPath
775
776
777// -------------------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 5

ExpandXPathFunction · 0.85
reserveMethod · 0.80
c_strMethod · 0.80
sizeMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected