arabica/include/XSLT/impl/handler/xslt_foreign_element_handler.hpp

45 lines
1.2 KiB
C++
Raw Normal View History

#ifndef ARABICA_XSLT_FOREIGN_ELEMENT_HPP
#define ARABICA_XSLT_FOREIGN_ELEMENT_HPP
namespace Arabica
{
namespace XSLT
{
2012-11-09 20:17:13 +01:00
template<class string_type, class string_adaptor>
class ForeignElementHandler : public SAX::DefaultHandler<string_type, string_adaptor>
{
public:
2012-11-09 20:17:13 +01:00
ForeignElementHandler(CompilationContext<string_type, string_adaptor>& context) :
context_(context),
depth_(0)
{
} // ForeignElementHandler
2012-11-09 20:17:13 +01:00
virtual void startElement(const string_type& /* namespaceURI */,
const string_type& /* localName */,
const string_type& /* qName */,
const SAX::Attributes<string_type, string_adaptor>& /* atts */)
{
++depth_;
} // startElement
2012-11-09 20:17:13 +01:00
virtual void endElement(const string_type& /* namespaceURI */,
const string_type& /* localName */,
const string_type& /* qName */)
{
if(--depth_ == 0)
context_.pop();
} // endElement
private:
2012-11-09 20:17:13 +01:00
CompilationContext<string_type, string_adaptor>& context_;
unsigned int depth_;
}; // class ForeignElementHandler
} // namespace XSLT
} // namespace Arabica
#endif