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

Method AppendProperties

xmpsdk/src/XMPUtils-FileInfo.cpp:1144–1189  ·  view source on GitHub ↗

class static */

Source from the content-addressed store, hash-verified

1142// ----------------
1143
1144/* class static */ void
1145XMPUtils::AppendProperties ( const XMPMeta & source,
1146 XMPMeta * dest,
1147 XMP_OptionBits options )
1148{
1149 XMP_Assert ( dest != 0 ); // ! Enforced by wrapper.
1150
1151 const bool doAll = ((options & kXMPUtil_DoAllProperties) != 0);
1152 const bool replaceOld = ((options & kXMPUtil_ReplaceOldValues) != 0);
1153 const bool deleteEmpty = ((options & kXMPUtil_DeleteEmptyValues) != 0);
1154
1155 for ( size_t schemaNum = 0, schemaLim = source.tree.children.size(); schemaNum != schemaLim; ++schemaNum ) {
1156
1157 const XMP_Node * sourceSchema = source.tree.children[schemaNum];
1158
1159 // Make sure we have a destination schema node. Remember if it is newly created.
1160
1161 XMP_Node * destSchema = FindSchemaNode ( &dest->tree, sourceSchema->name.c_str(), kXMP_ExistingOnly );
1162 const bool newDestSchema = (destSchema == 0);
1163 if ( newDestSchema ) {
1164 destSchema = new XMP_Node ( &dest->tree, sourceSchema->name, sourceSchema->value, kXMP_SchemaNode );
1165 dest->tree.children.push_back ( destSchema );
1166 }
1167
1168 // Process the source schema's children. Do this backwards in case deleteEmpty is set.
1169
1170 for ( long propNum = ((long)sourceSchema->children.size() - 1); propNum >= 0; --propNum ) {
1171 const XMP_Node * sourceProp = sourceSchema->children[propNum];
1172 if ( doAll || IsExternalProperty ( sourceSchema->name, sourceProp->name ) ) {
1173 AppendSubtree ( sourceProp, destSchema, replaceOld, deleteEmpty );
1174// *** RemoveMultiValueInfo ( dest, sourceSchema->name.c_str(), sourceProp->name.c_str() );
1175 }
1176 }
1177
1178 if ( destSchema->children.empty() ) {
1179 if ( newDestSchema ) {
1180 delete ( destSchema );
1181 dest->tree.children.pop_back();
1182 } else if ( deleteEmpty ) {
1183 DeleteEmptySchema ( destSchema );
1184 }
1185 }
1186
1187 }
1188
1189} // AppendProperties
1190
1191
1192// -------------------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 6

FindSchemaNodeFunction · 0.85
AppendSubtreeFunction · 0.85
DeleteEmptySchemaFunction · 0.85
c_strMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected