2007-07-19 19:01:42 +02:00
|
|
|
#ifndef ARABICA_XSLT_ITEM_HPP
|
|
|
|
#define ARABICA_XSLT_ITEM_HPP
|
|
|
|
|
|
|
|
namespace Arabica
|
|
|
|
{
|
|
|
|
namespace XSLT
|
|
|
|
{
|
|
|
|
|
|
|
|
class ExecutionContext;
|
|
|
|
|
|
|
|
class Item
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~Item()
|
|
|
|
{
|
|
|
|
} // ~Item
|
|
|
|
|
|
|
|
virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const = 0;
|
|
|
|
}; // class Item
|
|
|
|
|
|
|
|
class ItemContainer : public Item
|
|
|
|
{
|
|
|
|
protected:
|
2008-08-06 12:48:06 +02:00
|
|
|
virtual ~ItemContainer()
|
2007-07-19 19:01:42 +02:00
|
|
|
{
|
2008-08-06 12:48:06 +02:00
|
|
|
for(Children::const_iterator ci = children_.begin(), ce = children_.end(); ci != ce; ++ci)
|
|
|
|
delete *ci;
|
2007-07-19 19:01:42 +02:00
|
|
|
} // ~ItemContainer
|
|
|
|
|
|
|
|
void execute_children(const DOM::Node<std::string>& node, ExecutionContext& context) const
|
|
|
|
{
|
2008-08-06 12:48:06 +02:00
|
|
|
for(Children::const_iterator ci = children_.begin(), ce = children_.end(); ci != ce; ++ci)
|
|
|
|
(*ci)->execute(node, context);
|
2007-07-19 19:01:42 +02:00
|
|
|
} // execute
|
|
|
|
|
|
|
|
public:
|
|
|
|
void add_item(Item* child)
|
|
|
|
{
|
|
|
|
children_.push_back(child);
|
|
|
|
} // add_child
|
|
|
|
|
|
|
|
private:
|
2008-08-06 12:48:06 +02:00
|
|
|
typedef std::vector<Item*> Children;
|
2007-07-19 19:01:42 +02:00
|
|
|
Children children_;
|
|
|
|
}; // ItemContainer
|
|
|
|
|
|
|
|
} // namespace XSLT
|
|
|
|
} // namespace Arabica
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|