mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-29 08:36:45 +01:00
Removed use of boost:ptr_vector. Turns out that std::vector<boost::ptr_vector<something> > won't compile.
Also see http://sourceforge.net/mailarchive/message.php?msg_name=2103b1960807291110y5f0063eaqb4c855f5aa56974e%40mail.gmail.com and discussion for bonus reason.
This commit is contained in:
parent
1ce9e00043
commit
b187cc1667
4 changed files with 30 additions and 25 deletions
|
@ -1,7 +1,6 @@
|
|||
#ifndef ARABICA_XSLT_CHOOSE_HPP
|
||||
#define ARABICA_XSLT_CHOOSE_HPP
|
||||
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
#include "xslt_item.hpp"
|
||||
#include "xslt_if.hpp"
|
||||
|
||||
|
@ -54,16 +53,18 @@ public:
|
|||
|
||||
virtual ~Choose()
|
||||
{
|
||||
for(WhenList::const_iterator w = when_.begin(), e = when_.end(); w != e; ++w)
|
||||
delete (*w);
|
||||
delete otherwise_;
|
||||
} // ~Choose
|
||||
|
||||
virtual void execute(const DOM::Node<std::string>& node, ExecutionContext& context) const
|
||||
{
|
||||
ChainStackFrame frame(context);
|
||||
for(boost::ptr_vector<When>::const_iterator w = when_.begin(), e = when_.end(); w != e; ++w)
|
||||
if(w->is_met(node, context))
|
||||
for(WhenList::const_iterator w = when_.begin(), e = when_.end(); w != e; ++w)
|
||||
if((*w)->is_met(node, context))
|
||||
{
|
||||
w->execute(node, context);
|
||||
(*w)->execute(node, context);
|
||||
return;
|
||||
} // if ...
|
||||
|
||||
|
@ -83,7 +84,8 @@ public:
|
|||
} // set_otherwise
|
||||
|
||||
private:
|
||||
boost::ptr_vector<When> when_;
|
||||
typedef std::vector<When*> WhenList;
|
||||
WhenList when_;
|
||||
Otherwise* otherwise_;
|
||||
}; // class Choose
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef ARABICA_XSLT_ITEM_HPP
|
||||
#define ARABICA_XSLT_ITEM_HPP
|
||||
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
namespace Arabica
|
||||
{
|
||||
namespace XSLT
|
||||
|
@ -23,21 +21,18 @@ public:
|
|||
class ItemContainer : public Item
|
||||
{
|
||||
protected:
|
||||
typedef boost::ptr_vector<Item> Children;
|
||||
|
||||
~ItemContainer()
|
||||
virtual ~ItemContainer()
|
||||
{
|
||||
for(Children::const_iterator ci = children_.begin(), ce = children_.end(); ci != ce; ++ci)
|
||||
delete *ci;
|
||||
} // ~ItemContainer
|
||||
|
||||
void execute_children(const DOM::Node<std::string>& node, ExecutionContext& context) const
|
||||
{
|
||||
for(Children::const_iterator ci = children_begin(), ce = children_end(); ci != ce; ++ci)
|
||||
ci->execute(node, context);
|
||||
for(Children::const_iterator ci = children_.begin(), ce = children_.end(); ci != ce; ++ci)
|
||||
(*ci)->execute(node, context);
|
||||
} // execute
|
||||
|
||||
Children::const_iterator children_begin() const { return children_.begin(); }
|
||||
Children::const_iterator children_end() const { return children_.end(); }
|
||||
|
||||
public:
|
||||
void add_item(Item* child)
|
||||
{
|
||||
|
@ -45,6 +40,7 @@ public:
|
|||
} // add_child
|
||||
|
||||
private:
|
||||
typedef std::vector<Item*> Children;
|
||||
Children children_;
|
||||
}; // ItemContainer
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define ARABICA_XSLT_STYLESHEET_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
#include <iostream>
|
||||
#include <XPath/XPath.hpp>
|
||||
|
||||
|
@ -32,9 +31,14 @@ public:
|
|||
|
||||
~Stylesheet()
|
||||
{
|
||||
// let's clean up!
|
||||
for(ItemStack::const_iterator isi = items_.begin(), ise = items_.end(); isi != ise; ++isi)
|
||||
for(ItemList::const_iterator ci = isi->begin(), ce = isi->end(); ci != ce; ++ci)
|
||||
delete *ci;
|
||||
for(ParamList::const_iterator pi = params_.begin(), pe = params_.end(); pi != pe; ++pi)
|
||||
delete *pi;
|
||||
for(TemplateList::const_iterator ti = all_templates_.begin(), te = all_templates_.end(); ti != te; ++ti)
|
||||
delete *ti;
|
||||
} // ~Stylesheet
|
||||
|
||||
void set_parameter(const std::string& name, bool value)
|
||||
|
@ -75,8 +79,8 @@ public:
|
|||
ExecutionContext context(*this, output_.get(), *error_output_);
|
||||
|
||||
// set up variables and so forth
|
||||
for(boost::ptr_vector<TopLevelParam>::const_iterator pi = params_.begin(), pe = params_.end(); pi != pe; ++pi)
|
||||
pi->declare(context);
|
||||
for(ParamList::const_iterator pi = params_.begin(), pe = params_.end(); pi != pe; ++pi)
|
||||
(*pi)->declare(context);
|
||||
for(ItemStack::const_iterator isi = items_.begin(), ise = items_.end(); isi != ise; ++isi)
|
||||
{
|
||||
for(ItemList::const_iterator ci = isi->begin(), ce = isi->end(); ci != ce; ++ci)
|
||||
|
@ -297,7 +301,7 @@ private:
|
|||
Template* template_;
|
||||
}; // struct MatchTemplate
|
||||
|
||||
typedef boost::ptr_vector<Template> TemplateList;
|
||||
typedef std::vector<Template*> TemplateList;
|
||||
typedef std::vector<MatchTemplate> MatchTemplates;
|
||||
typedef std::map<std::pair<std::string, std::string>, MatchTemplates> ModeTemplates;
|
||||
typedef std::vector<ModeTemplates> TemplateStack;
|
||||
|
@ -306,7 +310,7 @@ private:
|
|||
typedef std::vector<Item*> ItemList;
|
||||
typedef std::vector<ItemList> ItemStack;
|
||||
|
||||
typedef boost::ptr_vector<TopLevelParam> ParamList;
|
||||
typedef std::vector<TopLevelParam*> ParamList;
|
||||
|
||||
TemplateList all_templates_;
|
||||
NamedTemplates named_templates_;
|
||||
|
|
|
@ -43,6 +43,8 @@ protected:
|
|||
|
||||
~WithParamable()
|
||||
{
|
||||
for(WithParamList::const_iterator s = withparams_.begin(), e = withparams_.end(); s != e; ++s)
|
||||
delete (*s);
|
||||
} // ~WithParamable
|
||||
|
||||
public:
|
||||
|
@ -54,17 +56,18 @@ public:
|
|||
private:
|
||||
void passParams(const DOM::Node<std::string>& node, ExecutionContext& context) const
|
||||
{
|
||||
for(boost::ptr_vector<WithParam>::const_iterator s = withparams_.begin(), e = withparams_.end(); s != e; ++s)
|
||||
s->execute(node, context);
|
||||
for(WithParamList::const_iterator s = withparams_.begin(), e = withparams_.end(); s != e; ++s)
|
||||
(*s)->execute(node, context);
|
||||
} // execute
|
||||
|
||||
void unpassParams(ExecutionContext& context) const
|
||||
{
|
||||
for(boost::ptr_vector<WithParam>::const_iterator s = withparams_.begin(), e = withparams_.end(); s != e; ++s)
|
||||
s->unpass(context);
|
||||
for(WithParamList::const_iterator s = withparams_.begin(), e = withparams_.end(); s != e; ++s)
|
||||
(*s)->unpass(context);
|
||||
} // unpassParams
|
||||
|
||||
boost::ptr_vector<WithParam> withparams_;
|
||||
typedef std::vector<WithParam*> WithParamList;
|
||||
WithParamList withparams_;
|
||||
|
||||
friend class ParamPasser;
|
||||
}; // class WithParamable
|
||||
|
|
Loading…
Add table
Reference in a new issue