void TextParser::pop_tag(const QString &tag) { Tag t(tag); stack<Tag> tags; bool bFound = false; QString text; while (!m_tags.empty()) { Tag top = m_tags.top(); m_tags.pop(); text += top.close_tag(); if (top == t) { bFound = true; break; } tags.push(top); } if (bFound) m_text += text; while (!tags.empty()) { Tag top = tags.top(); tags.pop(); if (bFound) m_text += top.open_tag(); m_tags.push(top); } }
bool TextParser::Tag::operator == (const Tag &t) const { return close_tag() == t.close_tag(); }