示例#1
0
void CXML_Element::RemoveChildren() {
  for (const ChildRecord& record : m_Children) {
    if (record.type == Content) {
      delete static_cast<CXML_Content*>(record.child);
    } else if (record.type == Element) {
      CXML_Element* child = static_cast<CXML_Element*>(record.child);
      child->RemoveChildren();
      delete child;
    }
  }
  m_Children.clear();
}
示例#2
0
void CXML_Element::RemoveChildren()
{
    for (int i = 0; i < m_Children.GetSize(); i += 2) {
        ChildType type = (ChildType)(uintptr_t)m_Children.GetAt(i);
        if (type == Content) {
            CXML_Content* content = (CXML_Content*)m_Children.GetAt(i + 1);
            delete content;
        } else if (type == Element) {
            CXML_Element* child = (CXML_Element*)m_Children.GetAt(i + 1);
            child->RemoveChildren();
            delete child;
        }
    }
    m_Children.RemoveAll();
}