aboutsummaryrefslogtreecommitdiff
path: root/python/dep_spec.cc
diff options
context:
space:
mode:
Diffstat (limited to 'python/dep_spec.cc')
-rw-r--r--python/dep_spec.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 0d568a4de..a631f58f2 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -148,6 +148,14 @@ PythonAnyDepSpec::PythonAnyDepSpec(const AnyDepSpec &)
{
}
+PythonExactlyOneDepSpec::PythonExactlyOneDepSpec()
+{
+}
+
+PythonExactlyOneDepSpec::PythonExactlyOneDepSpec(const ExactlyOneDepSpec &)
+{
+}
+
PythonAllDepSpec::PythonAllDepSpec()
{
}
@@ -548,6 +556,15 @@ SpecTreeToPython::visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node
}
void
+SpecTreeToPython::visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type & node)
+{
+ std::shared_ptr<PythonExactlyOneDepSpec> py_cds(std::make_shared<PythonExactlyOneDepSpec>(*node.spec()));
+ _current_parent->add_child(py_cds);
+ Save<std::shared_ptr<PythonCompositeDepSpec> > old_parent(&_current_parent, py_cds);
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+}
+
+void
SpecTreeToPython::visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
std::shared_ptr<PythonConditionalDepSpec> py_cds(std::make_shared<PythonConditionalDepSpec>(*node.spec()));
@@ -758,6 +775,13 @@ SpecTreeFromPython<H_>::visit(const PythonAnyDepSpec & d)
template <typename H_>
void
+SpecTreeFromPython<H_>::visit(const PythonExactlyOneDepSpec & d)
+{
+ dispatch<H_, ExactlyOneDepSpec>(this, d);
+}
+
+template <typename H_>
+void
SpecTreeFromPython<H_>::visit(const PythonConditionalDepSpec & d)
{
dispatch<H_, ConditionalDepSpec>(this, d);
@@ -851,6 +875,14 @@ SpecTreeFromPython<H_>::real_visit(const PythonAnyDepSpec & d)
template <typename H_>
void
+SpecTreeFromPython<H_>::real_visit(const PythonExactlyOneDepSpec & d)
+{
+ Save<std::shared_ptr<typename H_::BasicInnerNode> > old_add_to(&_add_to, _add_to->append(std::make_shared<ExactlyOneDepSpec>()));
+ std::for_each(indirect_iterator(d.begin()), indirect_iterator(d.end()), accept_visitor(*this));
+}
+
+template <typename H_>
+void
SpecTreeFromPython<H_>::real_visit(const PythonConditionalDepSpec & d)
{
Save<std::shared_ptr<typename H_::BasicInnerNode> > old_add_to(&_add_to, _add_to->append(std::make_shared<ConditionalDepSpec>(d.data())));
@@ -1108,6 +1140,16 @@ void expose_dep_spec()
);
/**
+ * ExactlyOneDepSpec
+ */
+ bp::class_<PythonExactlyOneDepSpec, bp::bases<PythonCompositeDepSpec>, boost::noncopyable>
+ (
+ "ExactlyOneDepSpec",
+ "Represents a \"^^ ( )\" dependency block.",
+ bp::init<>("__init__()")
+ );
+
+ /**
* AllDepSpec
*/
bp::class_<PythonAllDepSpec, bp::bases<PythonCompositeDepSpec>, boost::noncopyable>