diff --git a/src/common/ebml.h b/src/common/ebml.h index 62e919319..a0780eb27 100644 --- a/src/common/ebml.h +++ b/src/common/ebml.h @@ -203,6 +203,24 @@ GetFirstOrNextChild(EbmlMaster *master, return !previous_child ? GetChild(*master) : GetNextChild(*master, *previous_child); } +template +EbmlMaster * +DeleteChildren(EbmlMaster *master) { + for (auto idx = master->ListSize(); 0 < idx; --idx) + if (dynamic_cast((*master)[idx - 1])) { + delete (*master)[idx - 1]; + master->Remove(idx - 1); + } + + return master; +} + +template +EbmlMaster & +DeleteChildren(EbmlMaster &master) { + return *DeleteChildren(&master); +} + template memory_cptr find_and_clone_binary(EbmlElement &parent) {