From b06cb5eb2e5f29c7068de15946e9c4b50e45779e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 1 Dec 2013 14:44:13 +0100 Subject: [PATCH] common: add template function Is<>() testing EbmlElement for specific classes --- src/common/ebml.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/common/ebml.h b/src/common/ebml.h index 4ac0d08b0..31e20c1c1 100644 --- a/src/common/ebml.h +++ b/src/common/ebml.h @@ -298,6 +298,18 @@ GetChildValue(EbmlMaster *master) { return GetChild(master).GetValue(); } +template +bool +Is(EbmlElement *e) { + return !e ? false : (EbmlId(*e) == T::ClassInfos.GlobalId); +} + +template +bool +Is(EbmlElement *e) { + return !e ? false : Is(e) || Is(e); +} + EbmlElement *empty_ebml_master(EbmlElement *e); EbmlElement *create_ebml_element(const EbmlCallbacks &callbacks, const EbmlId &id); EbmlMaster *sort_ebml_master(EbmlMaster *e);