MCPcopy Create free account
hub / github.com/axmolengine/axmol / eraseObject

Method eraseObject

core/base/Vector.h:347–375  ·  view source on GitHub ↗

Remove a certain object in Vector. * @param object The object to be removed. * @param removeAll Whether to remove all elements with the same value. * If its value is 'false', it will just erase the first occurrence. */

Source from the content-addressed store, hash-verified

345 * If its value is 'false', it will just erase the first occurrence.
346 */
347 void eraseObject(T object, bool removeAll = false)
348 {
349 AXASSERT(object != nullptr, "The object should not be nullptr");
350
351 if (removeAll)
352 {
353 for (auto iter = _data.begin(); iter != _data.end();)
354 {
355 if ((*iter) == object)
356 {
357 iter = _data.erase(iter);
358 object->release();
359 }
360 else
361 {
362 ++iter;
363 }
364 }
365 }
366 else
367 {
368 auto iter = std::find(_data.begin(), _data.end(), object);
369 if (iter != _data.end())
370 {
371 _data.erase(iter);
372 object->release();
373 }
374 }
375 }
376
377 /** @brief Removes from the vector with an iterator.
378 * @param position Iterator pointing to a single element to be removed from the Vector.

Callers 15

removeChildBoneMethod · 0.80
removeShapeMethod · 0.80
removeBodyMethod · 0.80
removeBodyOrDelayMethod · 0.80
removeElementMethod · 0.80
removeChildMethod · 0.80
VectorTests.cppFile · 0.80
removeActionNodeMethod · 0.80
deleteFrameMethod · 0.80
removeBoneMethod · 0.80
changeBoneParentMethod · 0.80
removeContourDataMethod · 0.80

Calls 5

findFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected