mirror of https://github.com/OpenMW/openmw.git
replaced binary filter node with a n-ary node
parent
528e047fd5
commit
236dc9fc43
@ -1,58 +0,0 @@
|
||||
|
||||
#include "binarynode.hpp"
|
||||
|
||||
CSMFilter::BinaryNode::BinaryNode (boost::shared_ptr<Node> left, boost::shared_ptr<Node> right)
|
||||
: mLeft (left), mRight (right)
|
||||
{}
|
||||
|
||||
const CSMFilter::Node& CSMFilter::BinaryNode::getLeft() const
|
||||
{
|
||||
return *mLeft;
|
||||
}
|
||||
|
||||
CSMFilter::Node& CSMFilter::BinaryNode::getLeft()
|
||||
{
|
||||
return *mLeft;
|
||||
}
|
||||
|
||||
const CSMFilter::Node& CSMFilter::BinaryNode::getRight() const
|
||||
{
|
||||
return *mRight;
|
||||
}
|
||||
|
||||
CSMFilter::Node& CSMFilter::BinaryNode::getRight()
|
||||
{
|
||||
return *mRight;
|
||||
}
|
||||
|
||||
std::vector<std::string> CSMFilter::BinaryNode::getReferencedFilters() const
|
||||
{
|
||||
std::vector<std::string> left = mLeft->getReferencedFilters();
|
||||
|
||||
std::vector<std::string> right = mRight->getReferencedFilters();
|
||||
|
||||
left.insert (left.end(), right.begin(), right.end());
|
||||
|
||||
return left;
|
||||
}
|
||||
|
||||
std::vector<int> CSMFilter::BinaryNode::getReferencedColumns() const
|
||||
{
|
||||
std::vector<int> left = mLeft->getReferencedColumns();
|
||||
|
||||
std::vector<int> right = mRight->getReferencedColumns();
|
||||
|
||||
left.insert (left.end(), right.begin(), right.end());
|
||||
|
||||
return left;
|
||||
}
|
||||
|
||||
bool CSMFilter::BinaryNode::isSimple() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSMFilter::BinaryNode::hasUserValue() const
|
||||
{
|
||||
return mLeft->hasUserValue() || mRight->hasUserValue();
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
|
||||
#include "narynode.hpp"
|
||||
|
||||
CSMFilter::NAryNode::NAryNode (const std::vector<boost::shared_ptr<Node> >& nodes)
|
||||
: mNodes (nodes)
|
||||
{}
|
||||
|
||||
int CSMFilter::NAryNode::getSize() const
|
||||
{
|
||||
return mNodes.size();
|
||||
}
|
||||
|
||||
const CSMFilter::Node& CSMFilter::NAryNode::operator[] (int index) const
|
||||
{
|
||||
return *mNodes.at (index);
|
||||
}
|
||||
|
||||
std::vector<std::string> CSMFilter::NAryNode::getReferencedFilters() const
|
||||
{
|
||||
std::vector<std::string> filters;
|
||||
|
||||
for (std::vector<boost::shared_ptr<Node> >::const_iterator iter (mNodes.begin());
|
||||
iter!=mNodes.end(); ++iter)
|
||||
{
|
||||
std::vector<std::string> filters2 = (*iter)->getReferencedFilters();
|
||||
|
||||
filters.insert (filters.end(), filters2.begin(), filters2.end());
|
||||
}
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
std::vector<int> CSMFilter::NAryNode::getReferencedColumns() const
|
||||
{
|
||||
std::vector<int> columns;
|
||||
|
||||
for (std::vector<boost::shared_ptr<Node> >::const_iterator iter (mNodes.begin());
|
||||
iter!=mNodes.end(); ++iter)
|
||||
{
|
||||
std::vector<int> columns2 = (*iter)->getReferencedColumns();
|
||||
|
||||
columns.insert (columns.end(), columns2.begin(), columns2.end());
|
||||
}
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
bool CSMFilter::NAryNode::isSimple() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSMFilter::NAryNode::hasUserValue() const
|
||||
{
|
||||
for (std::vector<boost::shared_ptr<Node> >::const_iterator iter (mNodes.begin());
|
||||
iter!=mNodes.end(); ++iter)
|
||||
if ((*iter)->hasUserValue())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
Loading…
Reference in New Issue