MCPcopy Create free account
hub / github.com/audacity/audacity / InsertNewItemUsingPreferences

Method InsertNewItemUsingPreferences

libraries/lib-registries/Registry.cpp:247–284  ·  view source on GitHub ↗

For each group node, this is called only in the first pass of merging of items. It might fail to place an item in the first visitation of a registry, but then succeed in later visitations in the same or later runs of the program, because of persistent side-effects on the preferences done at the very end of the visitation.

Source from the content-addressed store, hash-verified

245// runs of the program, because of persistent side-effects on the
246// preferences done at the very end of the visitation.
247auto CollectedItems::InsertNewItemUsingPreferences(
248 ItemOrdering &itemOrdering, BaseItem *pItem )
249 -> bool
250{
251 // Note that if more than one plug-in registers items under the same
252 // node, then it is not specified which plug-in is handled first,
253 // the first time registration happens. It might happen that you
254 // add a plug-in, run the program, then add another, then run again;
255 // registration order determined by those actions might not
256 // correspond to the order of re-loading of modules in later
257 // sessions. But whatever ordering is chosen the first time some
258 // plug-in is seen -- that ordering gets remembered in preferences.
259
260 if ( !pItem->name.empty() ) {
261 // Check saved ordering first, and rebuild that as well as is possible
262 auto &ordering = itemOrdering.Get();
263 auto begin2 = ordering.begin(), end2 = ordering.end(),
264 found2 = std::find( begin2, end2, pItem->name );
265 if ( found2 != end2 ) {
266 auto insertPoint = items.end();
267 // Find the next name in the saved ordering that is known already
268 // in the collection.
269 while ( ++found2 != end2 ) {
270 auto known = Find( *found2 );
271 if ( known != insertPoint ) {
272 insertPoint = known;
273 break;
274 }
275 }
276 items.insert( insertPoint, {pItem, nullptr,
277 // Hints no longer matter:
278 {}} );
279 return true;
280 }
281 }
282
283 return false;
284}
285
286// For each group node, this may be called in the second and later passes
287// of merging of items

Callers

nothing calls this directly

Calls 6

FindFunction · 0.85
emptyMethod · 0.45
GetMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected