mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-28 22:05:03 +00:00
Deleting all children of type T from an EbmlMaster
This commit is contained in:
parent
1509b4a549
commit
a0563fb125
@ -203,6 +203,24 @@ GetFirstOrNextChild(EbmlMaster *master,
|
||||
return !previous_child ? GetChild<A>(*master) : GetNextChild<A>(*master, *previous_child);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
EbmlMaster *
|
||||
DeleteChildren(EbmlMaster *master) {
|
||||
for (auto idx = master->ListSize(); 0 < idx; --idx)
|
||||
if (dynamic_cast<T *>((*master)[idx - 1])) {
|
||||
delete (*master)[idx - 1];
|
||||
master->Remove(idx - 1);
|
||||
}
|
||||
|
||||
return master;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
EbmlMaster &
|
||||
DeleteChildren(EbmlMaster &master) {
|
||||
return *DeleteChildren<T>(&master);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
memory_cptr
|
||||
find_and_clone_binary(EbmlElement &parent) {
|
||||
|
Loading…
Reference in New Issue
Block a user