aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 22:03:40 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 22:03:40 +0000
commit57211c15f04a7fd382263319a154a555c757f09f (patch)
tree2e44e54591605475c0fdf061eceeae90d6a2c258 /python
parentf2476fe77fe49511a4c22544bf2cbccbc5cfd6cb (diff)
downloadpaludis-57211c15f04a7fd382263319a154a555c757f09f.tar.gz
paludis-57211c15f04a7fd382263319a154a555c757f09f.tar.xz
GenericSpecTree can contain ExactlyOneDepSpec
Diffstat (limited to 'python')
-rw-r--r--python/dep_spec.cc42
-rw-r--r--python/dep_spec.hh14
-rw-r--r--python/nice_names.nn1
3 files changed, 57 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>
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index 466a5eaf5..08ab37296 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -32,6 +32,7 @@ namespace paludis
class PythonCompositeDepSpec;
class PythonAllDepSpec;
class PythonAnyDepSpec;
+ class PythonExactlyOneDepSpec;
class PythonConditionalDepSpec;
class PythonStringDepSpec;
class PythonPlainTextDepSpec;
@@ -48,6 +49,7 @@ namespace paludis
class PALUDIS_VISIBLE PythonDepSpec :
public virtual DeclareAbstractAcceptMethods<PythonDepSpec, MakeTypeList<
PythonAnyDepSpec,
+ PythonExactlyOneDepSpec,
PythonAllDepSpec,
PythonConditionalDepSpec,
PythonBlockDepSpec,
@@ -102,6 +104,15 @@ namespace paludis
PythonAnyDepSpec(const AnyDepSpec &);
};
+ class PALUDIS_VISIBLE PythonExactlyOneDepSpec :
+ public PythonCompositeDepSpec,
+ public ImplementAcceptMethods<PythonDepSpec, PythonExactlyOneDepSpec>
+ {
+ public:
+ PythonExactlyOneDepSpec();
+ PythonExactlyOneDepSpec(const ExactlyOneDepSpec &);
+ };
+
class PALUDIS_VISIBLE PythonAllDepSpec :
public PythonCompositeDepSpec,
public ImplementAcceptMethods<PythonDepSpec, PythonAllDepSpec>
@@ -290,6 +301,7 @@ namespace paludis
void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type &);
void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type &);
+ void visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type &);
void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type &);
void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type &);
@@ -326,6 +338,7 @@ namespace paludis
void visit(const PythonAllDepSpec &);
void visit(const PythonAnyDepSpec &);
+ void visit(const PythonExactlyOneDepSpec &);
void visit(const PythonConditionalDepSpec &);
void visit(const PythonPackageDepSpec &);
void visit(const PythonPlainTextDepSpec &);
@@ -340,6 +353,7 @@ namespace paludis
void real_visit(const PythonAllDepSpec &);
void real_visit(const PythonAnyDepSpec &);
+ void real_visit(const PythonExactlyOneDepSpec &);
void real_visit(const PythonConditionalDepSpec &);
void real_visit(const PythonPackageDepSpec &);
void real_visit(const PythonPlainTextDepSpec &);
diff --git a/python/nice_names.nn b/python/nice_names.nn
index b7f5cf21a..5ef30e670 100644
--- a/python/nice_names.nn
+++ b/python/nice_names.nn
@@ -27,6 +27,7 @@ make_nn_NiceNames() {
name "SimpleURIDepSpec"
name "AllDepSpec"
name "AnyDepSpec"
+ name "ExactlyOneDepSpec"
name "ConditionalDepSpec"
name "BlockDepSpec"
name "StringDepSpec"