aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-18 04:22:54 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-18 04:22:54 +0000
commite4f407ecbc124d1af8da8a168e2684e85ef77298 (patch)
tree5d1f269bd94c701a9745dbf3dbc791e02dd3d3ff
parentbc764f5b47f5c6bd8580db7098f2f347acd91afb (diff)
downloadpaludis-e4f407ecbc124d1af8da8a168e2684e85ef77298.tar.gz
paludis-e4f407ecbc124d1af8da8a168e2684e85ef77298.tar.xz
Merge the dep_atom things into one file
-rw-r--r--paludis/all_dep_atom.cc30
-rw-r--r--paludis/all_dep_atom.hh52
-rw-r--r--paludis/any_dep_atom.cc31
-rw-r--r--paludis/any_dep_atom.hh51
-rw-r--r--paludis/args/args_option.cc2
-rw-r--r--paludis/block_dep_atom.cc33
-rw-r--r--paludis/block_dep_atom.hh69
-rw-r--r--paludis/composite_dep_atom.cc32
-rw-r--r--paludis/composite_dep_atom.hh85
-rw-r--r--paludis/default_config.hh2
-rw-r--r--paludis/dep_atom.cc159
-rw-r--r--paludis/dep_atom.hh263
-rw-r--r--paludis/dep_atom_dumper.cc7
-rw-r--r--paludis/dep_atom_dumper.hh1
-rw-r--r--paludis/dep_atom_dumper_TEST.cc6
-rw-r--r--paludis/dep_atom_flattener.cc6
-rw-r--r--paludis/dep_atom_flattener.hh1
-rw-r--r--paludis/dep_atom_pretty_printer.cc5
-rw-r--r--paludis/dep_atom_pretty_printer.hh2
-rw-r--r--paludis/dep_atom_visitor.cc23
-rw-r--r--paludis/dep_atom_visitor.hh40
-rw-r--r--paludis/dep_lexer.cc6
-rw-r--r--paludis/dep_list.cc10
-rw-r--r--paludis/dep_list.hh1
-rw-r--r--paludis/dep_parser.cc7
-rw-r--r--paludis/dep_parser.hh2
-rw-r--r--paludis/files.m47
-rw-r--r--paludis/match_package.hh4
-rw-r--r--paludis/package_database.cc2
-rw-r--r--paludis/package_database.hh4
-rw-r--r--paludis/package_dep_atom.cc152
-rw-r--r--paludis/package_dep_atom.hh129
-rw-r--r--paludis/portage_repository.cc2
-rw-r--r--paludis/qa/dep_any_check.cc7
-rw-r--r--paludis/qa/dep_flags_check.cc7
-rw-r--r--paludis/qa/deps_exist_check.cc7
-rw-r--r--paludis/qa/deps_visible_check.cc7
-rw-r--r--paludis/qa/pdepend_overlap_check.cc7
-rw-r--r--paludis/qa/rdepend_packages_check.cc7
-rw-r--r--paludis/use_dep_atom.cc39
-rw-r--r--paludis/use_dep_atom.hh74
41 files changed, 443 insertions, 938 deletions
diff --git a/paludis/all_dep_atom.cc b/paludis/all_dep_atom.cc
deleted file mode 100644
index 1e73d78..0000000
--- a/paludis/all_dep_atom.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "dep_atom_visitor.hh"
-
-using namespace paludis;
-
-AllDepAtom::AllDepAtom()
-{
-}
diff --git a/paludis/all_dep_atom.hh b/paludis/all_dep_atom.hh
deleted file mode 100644
index 500786c..0000000
--- a/paludis/all_dep_atom.hh
+++ /dev/null
@@ -1,52 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_ALL_DEP_ATOM_HH
-#define PALUDIS_GUARD_PALUDIS_ALL_DEP_ATOM_HH 1
-
-#include <paludis/composite_dep_atom.hh>
-#include <paludis/dep_atom_visitor.hh>
-
-/** \file
- * Declarations for the AllDepAtom class.
- *
- * \ingroup DepResolver
- */
-
-namespace paludis
-{
- /**
- * Represents a ( first second third ) or top level group of dependency
- * atoms.
- *
- * \ingroup DepResolver
- */
- class AllDepAtom :
- public CompositeDepAtom,
- public Visitable<AllDepAtom, DepAtomVisitorTypes>
- {
- public:
- /**
- * Constructor.
- */
- AllDepAtom();
- };
-}
-
-#endif
diff --git a/paludis/any_dep_atom.cc b/paludis/any_dep_atom.cc
deleted file mode 100644
index 730b836..0000000
--- a/paludis/any_dep_atom.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "dep_atom_visitor.hh"
-
-using namespace paludis;
-
-AnyDepAtom::AnyDepAtom()
-{
-}
-
diff --git a/paludis/any_dep_atom.hh b/paludis/any_dep_atom.hh
deleted file mode 100644
index 32412c2..0000000
--- a/paludis/any_dep_atom.hh
+++ /dev/null
@@ -1,51 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_ANY_DEP_ATOM_HH
-#define PALUDIS_GUARD_PALUDIS_ANY_DEP_ATOM_HH 1
-
-#include <paludis/composite_dep_atom.hh>
-#include <paludis/dep_atom_visitor.hh>
-
-/** \file
- * Declarations for AnyDepAtom.
- *
- * \ingroup DepResolver
- */
-
-namespace paludis
-{
- /**
- * Represents a "|| ( )" dependency block.
- *
- * \ingroup DepResolver
- */
- class AnyDepAtom :
- public CompositeDepAtom,
- public Visitable<AnyDepAtom, DepAtomVisitorTypes>
- {
- public:
- /**
- * Constructor.
- */
- AnyDepAtom();
- };
-}
-
-#endif
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index f6ab346..a338719 100644
--- a/paludis/args/args_option.cc
+++ b/paludis/args/args_option.cc
@@ -77,7 +77,7 @@ namespace
{
struct ArgIs
{
- const std::string & arg;
+ const std::string arg;
ArgIs(const std::string & a) :
arg(a)
diff --git a/paludis/block_dep_atom.cc b/paludis/block_dep_atom.cc
deleted file mode 100644
index b76947b..0000000
--- a/paludis/block_dep_atom.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "block_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "dep_atom_visitor.hh"
-
-using namespace paludis;
-
-BlockDepAtom::BlockDepAtom(PackageDepAtom::ConstPointer a) :
- _atom(a)
-{
-}
-
diff --git a/paludis/block_dep_atom.hh b/paludis/block_dep_atom.hh
deleted file mode 100644
index e515f45..0000000
--- a/paludis/block_dep_atom.hh
+++ /dev/null
@@ -1,69 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_BLOCK_DEP_ATOM_HH
-#define PALUDIS_GUARD_PALUDIS_BLOCK_DEP_ATOM_HH 1
-
-#include <paludis/dep_atom.hh>
-#include <paludis/package_dep_atom.hh>
-#include <paludis/dep_atom_visitor.hh>
-
-/** \file
- * Declarations for the BlockDepAtom class.
- *
- * \ingroup DepResolver
- */
-
-namespace paludis
-{
- /**
- * A BlockDepAtom represents a block on a package name (for example,
- * 'app-editors/vim'), possibly with associated version and SLOT
- * restrictions.
- *
- * \ingroup DepResolver
- */
- class BlockDepAtom :
- public DepAtom,
- public Visitable<BlockDepAtom, DepAtomVisitorTypes>
- {
- private:
- PackageDepAtom::ConstPointer _atom;
-
- public:
- /**
- * Constructor, with blocking atom.
- */
- BlockDepAtom(PackageDepAtom::ConstPointer atom);
-
- /**
- * Fetch the atom we're blocking.
- */
- PackageDepAtom::ConstPointer blocked_atom() const
- {
- return _atom;
- }
-
- typedef CountedPtr<BlockDepAtom, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const BlockDepAtom, count_policy::InternalCountTag> ConstPointer;
- };
-}
-
-
-#endif
diff --git a/paludis/composite_dep_atom.cc b/paludis/composite_dep_atom.cc
deleted file mode 100644
index c6b0ca7..0000000
--- a/paludis/composite_dep_atom.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "composite_dep_atom.hh"
-
-using namespace paludis;
-
-CompositeDepAtom::CompositeDepAtom()
-{
-}
-
-void
-CompositeDepAtom::add_child(DepAtom::ConstPointer c)
-{
- _children.push_back(c);
-}
diff --git a/paludis/composite_dep_atom.hh b/paludis/composite_dep_atom.hh
deleted file mode 100644
index 19d9c79..0000000
--- a/paludis/composite_dep_atom.hh
+++ /dev/null
@@ -1,85 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_COMPOSITE_DEP_ATOM_HH
-#define PALUDIS_GUARD_PALUDIS_COMPOSITE_DEP_ATOM_HH 1
-
-#include <paludis/dep_atom.hh>
-#include <paludis/counted_ptr.hh>
-#include <deque>
-
-/** \file
- * Declarations for the CompositeDepAtom class.
- *
- * \ingroup DepResolver
- */
-
-namespace paludis
-{
- /**
- * Class for dependency atoms that have a number of child dependency
- * atoms.
- *
- * \ingroup DepResolver
- */
- class CompositeDepAtom : public DepAtom,
- public virtual Composite<DepAtom, CompositeDepAtom>
- {
- private:
- std::deque<DepAtom::ConstPointer> _children;
-
- protected:
- /**
- * Constructor.
- */
- CompositeDepAtom();
-
- public:
- /**
- * Append a child to our collection.
- */
- virtual void add_child(DepAtom::ConstPointer);
-
- /**
- * Iterator for iterating over our children.
- */
- typedef std::deque<DepAtom::ConstPointer>::const_iterator Iterator;
-
- /**
- * Iterator to the start of our children.
- */
- Iterator begin() const
- {
- return _children.begin();
- }
-
- /**
- * Iterator to past the end of our children.
- */
- Iterator end() const
- {
- return _children.end();
- }
-
- typedef CountedPtr<CompositeDepAtom, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const CompositeDepAtom, count_policy::InternalCountTag> ConstPointer;
- };
-}
-
-#endif
diff --git a/paludis/default_config.hh b/paludis/default_config.hh
index 516a1d1..04bed9f 100644
--- a/paludis/default_config.hh
+++ b/paludis/default_config.hh
@@ -25,7 +25,7 @@
#include <paludis/indirect_iterator.hh>
#include <paludis/instantiation_policy.hh>
#include <paludis/keyword_name.hh>
-#include <paludis/package_dep_atom.hh>
+#include <paludis/dep_atom.hh>
#include <paludis/qualified_package_name.hh>
#include <paludis/smart_record.hh>
#include <paludis/use_flag_name.hh>
diff --git a/paludis/dep_atom.cc b/paludis/dep_atom.cc
index 427ef23..b64adc0 100644
--- a/paludis/dep_atom.cc
+++ b/paludis/dep_atom.cc
@@ -18,7 +18,6 @@
*/
#include "dep_atom.hh"
-#include "use_dep_atom.hh"
using namespace paludis;
@@ -36,3 +35,161 @@ DepAtom::as_use_dep_atom() const
return 0;
}
+CompositeDepAtom::CompositeDepAtom()
+{
+}
+
+void
+CompositeDepAtom::add_child(DepAtom::ConstPointer c)
+{
+ _children.push_back(c);
+}
+
+AnyDepAtom::AnyDepAtom()
+{
+}
+
+AllDepAtom::AllDepAtom()
+{
+}
+
+UseDepAtom::UseDepAtom(const UseFlagName & flag, bool inverse) :
+ _flag(flag),
+ _inverse(inverse)
+{
+}
+
+const UseDepAtom *
+UseDepAtom::as_use_dep_atom() const
+{
+ return this;
+}
+
+BlockDepAtom::BlockDepAtom(PackageDepAtom::ConstPointer a) :
+ _atom(a)
+{
+}
+
+PackageDepAtom::PackageDepAtom(const QualifiedPackageName & package) :
+ _package(package),
+ _version_operator("="),
+ _version_spec(0),
+ _slot(0)
+{
+}
+
+PackageDepAtom::PackageDepAtom(
+ const QualifiedPackageName & package,
+ VersionOperator version_operator,
+ CountedPtr<VersionSpec, count_policy::ExternalCountTag> version_spec_ptr,
+ CountedPtr<SlotName, count_policy::ExternalCountTag> slot_ptr) :
+ _package(package),
+ _version_operator(version_operator),
+ _version_spec(version_spec_ptr),
+ _slot(slot_ptr)
+{
+}
+
+PackageDepAtom::PackageDepAtom(const std::string & ss) :
+ _package(CategoryNamePart("later"), PackageNamePart("later")),
+ _version_operator("="),
+ _version_spec(0),
+ _slot(0)
+{
+ Context context("When parsing package dep atom '" + ss + "':");
+
+ try
+ {
+ std::string s(ss);
+
+ if (s.empty())
+ throw PackageDepAtomError("Got empty dep atom");
+
+ std::string::size_type slot_p;
+ if (std::string::npos != ((slot_p = s.rfind(':'))))
+ {
+ _slot.assign(new SlotName(s.substr(slot_p + 1)));
+ s.erase(slot_p);
+ }
+
+ if (std::string::npos != std::string("<>=~").find(s.at(0)))
+ {
+ std::string::size_type p(1);
+ if (s.length() > 1 && std::string::npos != std::string("<>=~").find(s.at(1)))
+ ++p;
+ _version_operator = s.substr(0, p);
+
+ std::string::size_type q(p);
+ while (true)
+ {
+ if (p >= s.length())
+ throw PackageDepAtomError("Couldn't parse dep atom '" + ss + "'");
+ q = s.find('-', q + 1);
+ if ((std::string::npos == q) || (++q >= s.length()))
+ throw PackageDepAtomError("Couldn't parse dep atom '" + ss + "'");
+ if (s.at(q) >= '0' && s.at(q) <= '9')
+ break;
+ }
+ _package = QualifiedPackageName(s.substr(p, q - p - 1));
+
+ if ('*' == s.at(s.length() - 1))
+ {
+ if (_version_operator != vo_equal)
+ throw PackageDepAtomError("Package dep atom '" + ss + "' uses * but not equals operator");
+ _version_operator = vo_equal_star;
+ _version_spec = CountedPtr<VersionSpec, count_policy::ExternalCountTag>(
+ new VersionSpec(s.substr(q, s.length() - q - 1)));
+ }
+ else
+ _version_spec = CountedPtr<VersionSpec, count_policy::ExternalCountTag>(
+ new VersionSpec(s.substr(q)));
+ }
+ else
+ _package = QualifiedPackageName(s);
+ }
+ catch (Exception &)
+ {
+ throw;
+ }
+ catch (const std::exception & e)
+ {
+ throw InternalError(PALUDIS_HERE, "caught std::exception '"
+ + stringify(e.what()) + "'");
+ }
+}
+
+PackageDepAtom::~PackageDepAtom()
+{
+}
+
+std::ostream &
+paludis::operator<< (std::ostream & s, const PackageDepAtom & a)
+{
+ if (a.version_spec_ptr())
+ {
+ if (a.version_operator() == vo_equal_star)
+ s << "=";
+ else
+ s << a.version_operator();
+ }
+
+ s << a.package();
+
+ if (a.version_spec_ptr())
+ {
+ s << "-" << *a.version_spec_ptr();
+
+ if (a.version_operator() == vo_equal_star)
+ s << "*";
+ }
+
+ if (a.slot_ptr())
+ s << *a.slot_ptr();
+ return s;
+}
+
+PackageDepAtomError::PackageDepAtomError(const std::string & msg) throw () :
+ Exception(msg)
+{
+}
+
diff --git a/paludis/dep_atom.hh b/paludis/dep_atom.hh
index 32bf5fe..d78d667 100644
--- a/paludis/dep_atom.hh
+++ b/paludis/dep_atom.hh
@@ -23,20 +23,36 @@
#include <paludis/attributes.hh>
#include <paludis/composite_pattern.hh>
#include <paludis/counted_ptr.hh>
-#include <paludis/dep_atom_visitor.hh>
#include <paludis/instantiation_policy.hh>
+#include <paludis/qualified_package_name.hh>
+#include <paludis/slot_name.hh>
+#include <paludis/use_flag_name.hh>
+#include <paludis/version_operator.hh>
+#include <paludis/version_spec.hh>
#include <paludis/visitor.hh>
+#include <list>
/** \file
- * Declarations for the DepAtom class.
+ * Declarations for the DepAtom classes.
*
* \ingroup DepResolver
*/
namespace paludis
{
+ class DepAtom;
class CompositeDepAtom;
+ class PackageDepAtom;
+ class AllDepAtom;
+ class AnyDepAtom;
class UseDepAtom;
+ class BlockDepAtom;
+
+ /**
+ * Visitor types for a visitor that can visit a DepAtom heirarchy.
+ */
+ typedef VisitorTypes<PackageDepAtom *, AllDepAtom *, AnyDepAtom *,
+ UseDepAtom *, BlockDepAtom *> DepAtomVisitorTypes;
/**
* Base class for a dependency atom.
@@ -61,6 +77,249 @@ namespace paludis
*/
virtual const UseDepAtom * as_use_dep_atom() const PALUDIS_ATTRIBUTE((pure));
};
+
+ /**
+ * Class for dependency atoms that have a number of child dependency
+ * atoms.
+ *
+ * \ingroup DepResolver
+ */
+ class CompositeDepAtom :
+ public DepAtom,
+ public virtual Composite<DepAtom, CompositeDepAtom>
+ {
+ private:
+ std::list<DepAtom::ConstPointer> _children;
+
+ protected:
+ /**
+ * Constructor.
+ */
+ CompositeDepAtom();
+
+ public:
+ /**
+ * Append a child to our collection.
+ */
+ virtual void add_child(DepAtom::ConstPointer);
+
+ /**
+ * Iterator for iterating over our children.
+ */
+ typedef std::list<DepAtom::ConstPointer>::const_iterator Iterator;
+
+ /**
+ * Iterator to the start of our children.
+ */
+ Iterator begin() const
+ {
+ return _children.begin();
+ }
+
+ /**
+ * Iterator to past the end of our children.
+ */
+ Iterator end() const
+ {
+ return _children.end();
+ }
+
+ typedef CountedPtr<CompositeDepAtom, count_policy::InternalCountTag> Pointer;
+ typedef CountedPtr<const CompositeDepAtom, count_policy::InternalCountTag> ConstPointer;
+ };
+
+ /**
+ * Represents a "|| ( )" dependency block.
+ *
+ * \ingroup DepResolver
+ */
+ class AnyDepAtom :
+ public CompositeDepAtom,
+ public Visitable<AnyDepAtom, DepAtomVisitorTypes>
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ AnyDepAtom();
+ };
+
+ /**
+ * Represents a ( first second third ) or top level group of dependency
+ * atoms.
+ *
+ * \ingroup DepResolver
+ */
+ class AllDepAtom :
+ public CompositeDepAtom,
+ public Visitable<AllDepAtom, DepAtomVisitorTypes>
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ AllDepAtom();
+ };
+
+ /**
+ * Represents a use? ( ) dependency atom.
+ *
+ * \ingroup DepResolver
+ */
+ class UseDepAtom :
+ public CompositeDepAtom,
+ public Visitable<UseDepAtom, DepAtomVisitorTypes>
+ {
+ private:
+ const UseFlagName _flag;
+ const bool _inverse;
+
+ public:
+ /**
+ * Constructor.
+ */
+ UseDepAtom(const UseFlagName &, bool);
+
+ /**
+ * Fetch our use flag name.
+ */
+ const UseFlagName & flag() const
+ {
+ return _flag;
+ }
+
+ /**
+ * Fetch whether we are a ! flag.
+ */
+ bool inverse() const
+ {
+ return _inverse;
+ }
+
+ virtual const UseDepAtom * as_use_dep_atom() const PALUDIS_ATTRIBUTE((pure));
+ };
+
+ /**
+ * A PackageDepAtom represents a package name (for example,
+ * 'app-editors/vim'), possibly with associated version and SLOT
+ * restrictions.
+ *
+ * \ingroup DepResolver
+ */
+ class PackageDepAtom :
+ public DepAtom,
+ public Visitable<PackageDepAtom, DepAtomVisitorTypes>
+ {
+ private:
+ QualifiedPackageName _package;
+ VersionOperator _version_operator;
+ CountedPtr<VersionSpec, count_policy::ExternalCountTag> _version_spec;
+ CountedPtr<SlotName, count_policy::ExternalCountTag> _slot;
+
+ public:
+ /**
+ * Constructor, no version or SLOT restrictions.
+ */
+ PackageDepAtom(const QualifiedPackageName & package);
+
+ /**
+ * Constructor, with restrictions.
+ */
+ PackageDepAtom(const QualifiedPackageName & package,
+ VersionOperator version_operator,
+ CountedPtr<VersionSpec, count_policy::ExternalCountTag> version_spec,
+ CountedPtr<SlotName, count_policy::ExternalCountTag> slot);
+
+ /**
+ * Constructor, parse restrictions ourself.
+ */
+ PackageDepAtom(const std::string &);
+
+ /**
+ * Destructor.
+ */
+ ~PackageDepAtom();
+
+ /**
+ * Fetch the package name.
+ */
+ const QualifiedPackageName & package() const
+ {
+ return _package;
+ }
+
+ /**
+ * Fetch the version operator.
+ */
+ const VersionOperator version_operator() const
+ {
+ return _version_operator;
+ }
+
+ /**
+ * Fetch the version spec (may be a zero pointer).
+ */
+ CountedPtr<VersionSpec, count_policy::ExternalCountTag> version_spec_ptr() const
+ {
+ return _version_spec;
+ }
+
+ /**
+ * Fetch the slot name (may be a zero pointer).
+ */
+ CountedPtr<SlotName, count_policy::ExternalCountTag> slot_ptr() const
+ {
+ return _slot;
+ }
+
+ typedef CountedPtr<PackageDepAtom, count_policy::InternalCountTag> Pointer;
+ typedef CountedPtr<const PackageDepAtom, count_policy::InternalCountTag> ConstPointer;
+ };
+
+ class PackageDepAtomError :
+ public Exception
+ {
+ public:
+ PackageDepAtomError(const std::string & msg) throw ();
+ };
+
+ /**
+ * A PackageDepAtom can be written to an ostream.
+ */
+ std::ostream & operator<< (std::ostream &, const PackageDepAtom &);
+
+ /**
+ * A BlockDepAtom represents a block on a package name (for example,
+ * 'app-editors/vim'), possibly with associated version and SLOT
+ * restrictions.
+ *
+ * \ingroup DepResolver
+ */
+ class BlockDepAtom :
+ public DepAtom,
+ public Visitable<BlockDepAtom, DepAtomVisitorTypes>
+ {
+ private:
+ PackageDepAtom::ConstPointer _atom;
+
+ public:
+ /**
+ * Constructor, with blocking atom.
+ */
+ BlockDepAtom(PackageDepAtom::ConstPointer atom);
+
+ /**
+ * Fetch the atom we're blocking.
+ */
+ PackageDepAtom::ConstPointer blocked_atom() const
+ {
+ return _atom;
+ }
+
+ typedef CountedPtr<BlockDepAtom, count_policy::InternalCountTag> Pointer;
+ typedef CountedPtr<const BlockDepAtom, count_policy::InternalCountTag> ConstPointer;
+ };
+
}
#endif
diff --git a/paludis/dep_atom_dumper.cc b/paludis/dep_atom_dumper.cc
index 7c05032..2c87977 100644
--- a/paludis/dep_atom_dumper.cc
+++ b/paludis/dep_atom_dumper.cc
@@ -17,12 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "block_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "dep_atom_visitor.hh"
+#include "dep_atom.hh"
#include "dep_atom_dumper.hh"
#include <algorithm>
diff --git a/paludis/dep_atom_dumper.hh b/paludis/dep_atom_dumper.hh
index 1b49a10..55f422f 100644
--- a/paludis/dep_atom_dumper.hh
+++ b/paludis/dep_atom_dumper.hh
@@ -20,7 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_ATOM_DUMPER_HH
#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_DUMPER_HH 1
-#include <paludis/dep_atom_visitor.hh>
#include <paludis/instantiation_policy.hh>
#include <ostream>
diff --git a/paludis/dep_atom_dumper_TEST.cc b/paludis/dep_atom_dumper_TEST.cc
index 5e9adc4..a122968 100644
--- a/paludis/dep_atom_dumper_TEST.cc
+++ b/paludis/dep_atom_dumper_TEST.cc
@@ -19,11 +19,7 @@
#include <test/test_framework.hh>
#include <test/test_runner.hh>
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "dep_atom_visitor.hh"
+#include "dep_atom.hh"
#include "dep_atom_dumper.hh"
#include <sstream>
diff --git a/paludis/dep_atom_flattener.cc b/paludis/dep_atom_flattener.cc
index c2f32ac..96e34a5 100644
--- a/paludis/dep_atom_flattener.cc
+++ b/paludis/dep_atom_flattener.cc
@@ -18,11 +18,7 @@
*/
#include "dep_atom_flattener.hh"
-#include "package_dep_atom.hh"
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "block_dep_atom.hh"
-#include "use_dep_atom.hh"
+#include "dep_atom.hh"
using namespace paludis;
diff --git a/paludis/dep_atom_flattener.hh b/paludis/dep_atom_flattener.hh
index adedceb..d2a3369 100644
--- a/paludis/dep_atom_flattener.hh
+++ b/paludis/dep_atom_flattener.hh
@@ -22,7 +22,6 @@
#include <paludis/attributes.hh>
#include <paludis/dep_atom.hh>
-#include <paludis/dep_atom_visitor.hh>
#include <paludis/environment.hh>
#include <paludis/instantiation_policy.hh>
#include <paludis/package_database.hh>
diff --git a/paludis/dep_atom_pretty_printer.cc b/paludis/dep_atom_pretty_printer.cc
index a2777f5..4ffe757 100644
--- a/paludis/dep_atom_pretty_printer.cc
+++ b/paludis/dep_atom_pretty_printer.cc
@@ -19,11 +19,6 @@
#include "dep_atom_pretty_printer.hh"
#include "dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "all_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "block_dep_atom.hh"
#include "save.hh"
#include <algorithm>
diff --git a/paludis/dep_atom_pretty_printer.hh b/paludis/dep_atom_pretty_printer.hh
index bd12749..919e8ed 100644
--- a/paludis/dep_atom_pretty_printer.hh
+++ b/paludis/dep_atom_pretty_printer.hh
@@ -20,7 +20,7 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_ATOM_PRETTY_PRINTER_HH
#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_PRETTY_PRINTER_HH 1
-#include <paludis/dep_atom_visitor.hh>
+#include <paludis/dep_atom.hh>
#include <ostream>
#include <sstream>
diff --git a/paludis/dep_atom_visitor.cc b/paludis/dep_atom_visitor.cc
deleted file mode 100644
index 3ed873f..0000000
--- a/paludis/dep_atom_visitor.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "dep_atom_visitor.hh"
-
-using namespace paludis;
-
diff --git a/paludis/dep_atom_visitor.hh b/paludis/dep_atom_visitor.hh
deleted file mode 100644
index ecd8bc3..0000000
--- a/paludis/dep_atom_visitor.hh
+++ /dev/null
@@ -1,40 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_DEP_ATOM_VISITOR_HH
-#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_VISITOR_HH 1
-
-#include <paludis/visitor.hh>
-
-namespace paludis
-{
- class PackageDepAtom;
- class AllDepAtom;
- class AnyDepAtom;
- class UseDepAtom;
- class BlockDepAtom;
-
- /**
- * Visitor types for a visitor that can visit a DepAtom heirarchy.
- */
- typedef VisitorTypes<PackageDepAtom *, AllDepAtom *, AnyDepAtom *,
- UseDepAtom *, BlockDepAtom *> DepAtomVisitorTypes;
-}
-
-#endif
diff --git a/paludis/dep_lexer.cc b/paludis/dep_lexer.cc
index 498ed45..e593b46 100644
--- a/paludis/dep_lexer.cc
+++ b/paludis/dep_lexer.cc
@@ -17,11 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "dep_atom_visitor.hh"
+#include "dep_atom.hh"
#include "dep_lexer.hh"
#include "exception.hh"
#include "tokeniser.hh"
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 7bdb4d1..ff67db3 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -17,10 +17,8 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "block_dep_atom.hh"
#include "container_entry.hh"
+#include "dep_atom.hh"
#include "dep_atom_flattener.hh"
#include "dep_list.hh"
#include "dep_parser.hh"
@@ -30,10 +28,8 @@
#include "join.hh"
#include "log.hh"
#include "match_package.hh"
-#include "package_dep_atom.hh"
#include "save.hh"
#include "stringify.hh"
-#include "use_dep_atom.hh"
#include <algorithm>
#include <functional>
@@ -513,7 +509,7 @@ DepList::visit(const AnyDepAtom * const a)
* we handle this by keeping a list of 'viable children'.
*/
- std::deque<DepAtom::ConstPointer> viable_children;
+ std::list<DepAtom::ConstPointer> viable_children;
std::copy(a->begin(), a->end(), filter_inserter(
std::back_inserter(viable_children), IsViable(*_implementation)));
@@ -526,7 +522,7 @@ DepList::visit(const AnyDepAtom * const a)
}
bool found(false);
- for (CompositeDepAtom::Iterator i(viable_children.begin()),
+ for (std::list<DepAtom::ConstPointer>::iterator i(viable_children.begin()),
i_end(viable_children.end()) ; i != i_end ; ++i)
{
Save<bool> save_check(&_implementation->check_existing_only, true);
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index 9789b65..3f34e67 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -21,7 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_DEP_LIST_HH 1
#include <paludis/dep_atom.hh>
-#include <paludis/dep_atom_visitor.hh>
#include <paludis/environment.hh>
#include <paludis/instantiation_policy.hh>
#include <paludis/private_implementation_pattern.hh>
diff --git a/paludis/dep_parser.cc b/paludis/dep_parser.cc
index 78e1732..d89acdf 100644
--- a/paludis/dep_parser.cc
+++ b/paludis/dep_parser.cc
@@ -19,14 +19,9 @@
#include "exception.hh"
#include "stringify.hh"
+#include "dep_atom.hh"
#include "dep_parser.hh"
#include "dep_lexer.hh"
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "block_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "dep_atom_visitor.hh"
#include <stack>
using namespace paludis;
diff --git a/paludis/dep_parser.hh b/paludis/dep_parser.hh
index 17c728d..a82adae 100644
--- a/paludis/dep_parser.hh
+++ b/paludis/dep_parser.hh
@@ -20,7 +20,7 @@
#ifndef PALUDIS_GUARD_PALUDIS_DEP_PARSER_HH
#define PALUDIS_GUARD_PALUDIS_DEP_PARSER_HH 1
-#include <paludis/composite_dep_atom.hh>
+#include <paludis/dep_atom.hh>
#include <paludis/counted_ptr.hh>
#include <paludis/instantiation_policy.hh>
#include <paludis/exception.hh>
diff --git a/paludis/files.m4 b/paludis/files.m4
index 980d779..b544aa6 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -9,14 +9,10 @@ dnl `test', `impl', `testscript'. Note that there isn't much error checking done
dnl on this file at present...
add(`about', `hh', `test')
-add(`all_dep_atom', `hh', `cc')
-add(`any_dep_atom', `hh', `cc')
add(`attributes', `hh', `cc')
-add(`block_dep_atom', `hh', `cc')
add(`category_name_part', `hh', `cc', `test')
add(`compare', `hh', `cc')
add(`comparison_policy', `hh', `cc', `test')
-add(`composite_dep_atom', `hh', `cc')
add(`composite_pattern', `hh', `cc')
add(`config_file', `hh', `cc', `test', `testscript')
add(`container_entry', `hh', `cc', `test')
@@ -28,7 +24,6 @@ add(`deleter', `hh', `cc', `test')
add(`dep_atom', `hh', `cc')
add(`dep_atom_dumper', `hh', `cc', `test')
add(`dep_atom_flattener', `hh', `cc')
-add(`dep_atom_visitor', `hh', `cc')
add(`dep_atom_pretty_printer', `hh', `cc')
add(`dep_lexer', `hh', `cc', `test')
add(`dep_list', `hh', `cc', `test')
@@ -55,7 +50,6 @@ add(`log', `hh', `cc', `test')
add(`mask_reasons', `hh', `cc')
add(`match_package', `hh', `cc')
add(`package_database', `hh', `cc', `test')
-add(`package_dep_atom', `hh', `cc', `test')
add(`package_name_part', `hh', `cc', `test')
add(`paludis', `hh', `cc')
add(`portage_repository', `hh', `cc')
@@ -74,7 +68,6 @@ add(`strip', `hh', `cc', `test')
add(`tokeniser', `hh', `cc', `test')
add(`test_environment', `hh', `cc')
add(`transform_insert_iterator', `hh', `cc', `test')
-add(`use_dep_atom', `hh', `cc')
add(`use_flag_name', `hh', `cc')
add(`use_flag_state', `hh', `cc')
add(`validated', `hh', `cc', `test')
diff --git a/paludis/match_package.hh b/paludis/match_package.hh
index 3360a43..afbfe17 100644
--- a/paludis/match_package.hh
+++ b/paludis/match_package.hh
@@ -12,9 +12,9 @@
*/
#include <paludis/attributes.hh>
-#include <paludis/package_database.hh>
-#include <paludis/package_dep_atom.hh>
+#include <paludis/dep_atom.hh>
#include <paludis/dep_list.hh>
+#include <paludis/package_database.hh>
namespace paludis
{
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index f4d44d5..8eb39a9 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -17,8 +17,8 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "dep_atom.hh"
#include "package_database.hh"
-#include "package_dep_atom.hh"
#include "indirect_iterator.hh"
#include "stringify.hh"
#include "match_package.hh"
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index aa13b48..b27a5d2 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -21,9 +21,10 @@
#define PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_HH 1
#include <paludis/counted_ptr.hh>
+#include <paludis/dep_atom.hh>
#include <paludis/exception.hh>
#include <paludis/instantiation_policy.hh>
-#include <paludis/package_dep_atom.hh>
+#include <paludis/join.hh>
#include <paludis/private_implementation_pattern.hh>
#include <paludis/qualified_package_name.hh>
#include <paludis/repository.hh>
@@ -31,7 +32,6 @@
#include <paludis/sorted_collection.hh>
#include <paludis/version_metadata.hh>
#include <paludis/version_spec.hh>
-#include <paludis/join.hh>
#include <ostream>
diff --git a/paludis/package_dep_atom.cc b/paludis/package_dep_atom.cc
deleted file mode 100644
index 2c419bb..0000000
--- a/paludis/package_dep_atom.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "exception.hh"
-#include "stringify.hh"
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "dep_atom_visitor.hh"
-
-using namespace paludis;
-
-PackageDepAtom::PackageDepAtom(const QualifiedPackageName & package) :
- _package(package),
- _version_operator("="),
- _version_spec(0),
- _slot(0)
-{
-}
-
-PackageDepAtom::PackageDepAtom(
- const QualifiedPackageName & package,
- VersionOperator version_operator,
- CountedPtr<VersionSpec, count_policy::ExternalCountTag> version_spec_ptr,
- CountedPtr<SlotName, count_policy::ExternalCountTag> slot_ptr) :
- _package(package),
- _version_operator(version_operator),
- _version_spec(version_spec_ptr),
- _slot(slot_ptr)
-{
-}
-
-PackageDepAtom::PackageDepAtom(const std::string & ss) :
- _package(CategoryNamePart("later"), PackageNamePart("later")),
- _version_operator("="),
- _version_spec(0),
- _slot(0)
-{
- Context context("When parsing package dep atom '" + ss + "':");
-
- try
- {
- std::string s(ss);
-
- if (s.empty())
- throw PackageDepAtomError("Got empty dep atom");
-
- std::string::size_type slot_p;
- if (std::string::npos != ((slot_p = s.rfind(':'))))
- {
- _slot.assign(new SlotName(s.substr(slot_p + 1)));
- s.erase(slot_p);
- }
-
- if (std::string::npos != std::string("<>=~").find(s.at(0)))
- {
- std::string::size_type p(1);
- if (s.length() > 1 && std::string::npos != std::string("<>=~").find(s.at(1)))
- ++p;
- _version_operator = s.substr(0, p);
-
- std::string::size_type q(p);
- while (true)
- {
- if (p >= s.length())
- throw PackageDepAtomError("Couldn't parse dep atom '" + ss + "'");
- q = s.find('-', q + 1);
- if ((std::string::npos == q) || (++q >= s.length()))
- throw PackageDepAtomError("Couldn't parse dep atom '" + ss + "'");
- if (s.at(q) >= '0' && s.at(q) <= '9')
- break;
- }
- _package = QualifiedPackageName(s.substr(p, q - p - 1));
-
- if ('*' == s.at(s.length() - 1))
- {
- if (_version_operator != vo_equal)
- throw PackageDepAtomError("Package dep atom '" + ss + "' uses * but not equals operator");
- _version_operator = vo_equal_star;
- _version_spec = CountedPtr<VersionSpec, count_policy::ExternalCountTag>(
- new VersionSpec(s.substr(q, s.length() - q - 1)));
- }
- else
- _version_spec = CountedPtr<VersionSpec, count_policy::ExternalCountTag>(
- new VersionSpec(s.substr(q)));
- }
- else
- _package = QualifiedPackageName(s);
- }
- catch (Exception &)
- {
- throw;
- }
- catch (const std::exception & e)
- {
- throw InternalError(PALUDIS_HERE, "caught std::exception '"
- + stringify(e.what()) + "'");
- }
-}
-
-PackageDepAtom::~PackageDepAtom()
-{
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & s, const PackageDepAtom & a)
-{
- if (a.version_spec_ptr())
- {
- if (a.version_operator() == vo_equal_star)
- s << "=";
- else
- s << a.version_operator();
- }
-
- s << a.package();
-
- if (a.version_spec_ptr())
- {
- s << "-" << *a.version_spec_ptr();
-
- if (a.version_operator() == vo_equal_star)
- s << "*";
- }
-
- if (a.slot_ptr())
- s << *a.slot_ptr();
- return s;
-}
-
-PackageDepAtomError::PackageDepAtomError(const std::string & msg) throw () :
- Exception(msg)
-{
-}
-
diff --git a/paludis/package_dep_atom.hh b/paludis/package_dep_atom.hh
deleted file mode 100644
index 6bbfc50..0000000
--- a/paludis/package_dep_atom.hh
+++ /dev/null
@@ -1,129 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_PACKAGE_DEP_ATOM_HH
-#define PALUDIS_GUARD_PALUDIS_PACKAGE_DEP_ATOM_HH 1
-
-#include <paludis/dep_atom.hh>
-#include <paludis/qualified_package_name.hh>
-#include <paludis/version_operator.hh>
-#include <paludis/slot_name.hh>
-#include <paludis/version_spec.hh>
-#include <paludis/dep_atom_visitor.hh>
-#include <ostream>
-
-/** \file
- * Declarations for the PackageDepAtom class.
- *
- * \ingroup DepResolver
- */
-
-namespace paludis
-{
- /**
- * A PackageDepAtom represents a package name (for example,
- * 'app-editors/vim'), possibly with associated version and SLOT
- * restrictions.
- *
- * \ingroup DepResolver
- */
- class PackageDepAtom :
- public DepAtom,
- public Visitable<PackageDepAtom, DepAtomVisitorTypes>
- {
- private:
- QualifiedPackageName _package;
- VersionOperator _version_operator;
- CountedPtr<VersionSpec, count_policy::ExternalCountTag> _version_spec;
- CountedPtr<SlotName, count_policy::ExternalCountTag> _slot;
-
- public:
- /**
- * Constructor, no version or SLOT restrictions.
- */
- PackageDepAtom(const QualifiedPackageName & package);
-
- /**
- * Constructor, with restrictions.
- */
- PackageDepAtom(const QualifiedPackageName & package,
- VersionOperator version_operator,
- CountedPtr<VersionSpec, count_policy::ExternalCountTag> version_spec,
- CountedPtr<SlotName, count_policy::ExternalCountTag> slot);
-
- /**
- * Constructor, parse restrictions ourself.
- */
- PackageDepAtom(const std::string &);
-
- /**
- * Destructor.
- */
- ~PackageDepAtom();
-
- /**
- * Fetch the package name.
- */
- const QualifiedPackageName & package() const
- {
- return _package;
- }
-
- /**
- * Fetch the version operator.
- */
- const VersionOperator version_operator() const
- {
- return _version_operator;
- }
-
- /**
- * Fetch the version spec (may be a zero pointer).
- */
- CountedPtr<VersionSpec, count_policy::ExternalCountTag> version_spec_ptr() const
- {
- return _version_spec;
- }
-
- /**
- * Fetch the slot name (may be a zero pointer).
- */
- CountedPtr<SlotName, count_policy::ExternalCountTag> slot_ptr() const
- {
- return _slot;
- }
-
- typedef CountedPtr<PackageDepAtom, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const PackageDepAtom, count_policy::InternalCountTag> ConstPointer;
- };
-
- class PackageDepAtomError :
- public Exception
- {
- public:
- PackageDepAtomError(const std::string & msg) throw ();
- };
-
- /**
- * A PackageDepAtom can be written to an ostream.
- */
- std::ostream & operator<< (std::ostream &, const PackageDepAtom &);
-}
-
-#endif
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 12f7ed9..f44b31f 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -21,6 +21,7 @@
#include "create_insert_iterator.hh"
#include "dir_iterator.hh"
+#include "dep_atom.hh"
#include "filter_insert_iterator.hh"
#include "fs_entry.hh"
#include "getenv.hh"
@@ -32,7 +33,6 @@
#include "log.hh"
#include "match_package.hh"
#include "package_database.hh"
-#include "package_dep_atom.hh"
#include "portage_repository.hh"
#include "pstream.hh"
#include "stringify.hh"
diff --git a/paludis/qa/dep_any_check.cc b/paludis/qa/dep_any_check.cc
index dcd79a0..7882a8f 100644
--- a/paludis/qa/dep_any_check.cc
+++ b/paludis/qa/dep_any_check.cc
@@ -20,12 +20,7 @@
#include "dep_any_check.hh"
#include <paludis/dep_parser.hh>
-#include <paludis/dep_atom_visitor.hh>
-#include <paludis/any_dep_atom.hh>
-#include <paludis/all_dep_atom.hh>
-#include <paludis/package_dep_atom.hh>
-#include <paludis/block_dep_atom.hh>
-#include <paludis/use_dep_atom.hh>
+#include <paludis/dep_atom.hh>
#include <paludis/iterator_utilities.hh>
#include <paludis/save.hh>
diff --git a/paludis/qa/dep_flags_check.cc b/paludis/qa/dep_flags_check.cc
index 63a9db1..ffbb47c 100644
--- a/paludis/qa/dep_flags_check.cc
+++ b/paludis/qa/dep_flags_check.cc
@@ -19,12 +19,7 @@
#include "dep_flags_check.hh"
#include <paludis/dep_parser.hh>
-#include <paludis/dep_atom_visitor.hh>
-#include <paludis/any_dep_atom.hh>
-#include <paludis/all_dep_atom.hh>
-#include <paludis/package_dep_atom.hh>
-#include <paludis/block_dep_atom.hh>
-#include <paludis/use_dep_atom.hh>
+#include <paludis/dep_atom.hh>
using namespace paludis;
using namespace paludis::qa;
diff --git a/paludis/qa/deps_exist_check.cc b/paludis/qa/deps_exist_check.cc
index 7cbb180..fdcccfa 100644
--- a/paludis/qa/deps_exist_check.cc
+++ b/paludis/qa/deps_exist_check.cc
@@ -19,12 +19,7 @@
#include "deps_exist_check.hh"
#include <paludis/dep_parser.hh>
-#include <paludis/dep_atom_visitor.hh>
-#include <paludis/any_dep_atom.hh>
-#include <paludis/all_dep_atom.hh>
-#include <paludis/package_dep_atom.hh>
-#include <paludis/block_dep_atom.hh>
-#include <paludis/use_dep_atom.hh>
+#include <paludis/dep_atom.hh>
#include <paludis/save.hh>
using namespace paludis;
diff --git a/paludis/qa/deps_visible_check.cc b/paludis/qa/deps_visible_check.cc
index 6862499..b5e96f4 100644
--- a/paludis/qa/deps_visible_check.cc
+++ b/paludis/qa/deps_visible_check.cc
@@ -20,12 +20,7 @@
#include "deps_visible_check.hh"
#include <paludis/dep_parser.hh>
-#include <paludis/dep_atom_visitor.hh>
-#include <paludis/any_dep_atom.hh>
-#include <paludis/all_dep_atom.hh>
-#include <paludis/package_dep_atom.hh>
-#include <paludis/block_dep_atom.hh>
-#include <paludis/use_dep_atom.hh>
+#include <paludis/dep_atom.hh>
using namespace paludis;
using namespace paludis::qa;
diff --git a/paludis/qa/pdepend_overlap_check.cc b/paludis/qa/pdepend_overlap_check.cc
index 1fdd862..840e632 100644
--- a/paludis/qa/pdepend_overlap_check.cc
+++ b/paludis/qa/pdepend_overlap_check.cc
@@ -19,12 +19,7 @@
#include "pdepend_overlap_check.hh"
#include <paludis/dep_parser.hh>
-#include <paludis/dep_atom_visitor.hh>
-#include <paludis/any_dep_atom.hh>
-#include <paludis/all_dep_atom.hh>
-#include <paludis/package_dep_atom.hh>
-#include <paludis/block_dep_atom.hh>
-#include <paludis/use_dep_atom.hh>
+#include <paludis/dep_atom.hh>
#include <paludis/join.hh>
using namespace paludis;
diff --git a/paludis/qa/rdepend_packages_check.cc b/paludis/qa/rdepend_packages_check.cc
index a03e759..8ef8d79 100644
--- a/paludis/qa/rdepend_packages_check.cc
+++ b/paludis/qa/rdepend_packages_check.cc
@@ -19,12 +19,7 @@
#include "rdepend_packages_check.hh"
#include <paludis/dep_parser.hh>
-#include <paludis/dep_atom_visitor.hh>
-#include <paludis/any_dep_atom.hh>
-#include <paludis/all_dep_atom.hh>
-#include <paludis/package_dep_atom.hh>
-#include <paludis/block_dep_atom.hh>
-#include <paludis/use_dep_atom.hh>
+#include <paludis/dep_atom.hh>
using namespace paludis;
using namespace paludis::qa;
diff --git a/paludis/use_dep_atom.cc b/paludis/use_dep_atom.cc
deleted file mode 100644
index 6541664..0000000
--- a/paludis/use_dep_atom.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "all_dep_atom.hh"
-#include "any_dep_atom.hh"
-#include "use_dep_atom.hh"
-#include "package_dep_atom.hh"
-#include "dep_atom_visitor.hh"
-
-using namespace paludis;
-
-UseDepAtom::UseDepAtom(const UseFlagName & flag, bool inverse) :
- _flag(flag),
- _inverse(inverse)
-{
-}
-
-const UseDepAtom *
-UseDepAtom::as_use_dep_atom() const
-{
- return this;
-}
-
diff --git a/paludis/use_dep_atom.hh b/paludis/use_dep_atom.hh
deleted file mode 100644
index 78689a9..0000000
--- a/paludis/use_dep_atom.hh
+++ /dev/null
@@ -1,74 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_USE_DEP_ATOM_HH
-#define PALUDIS_GUARD_PALUDIS_USE_DEP_ATOM_HH 1
-
-#include <paludis/composite_dep_atom.hh>
-#include <paludis/use_flag_name.hh>
-#include <paludis/dep_atom_visitor.hh>
-
-/** \file
- * Declarations for the UseDepAtom class.
- *
- * \ingroup DepResolver
- */
-
-namespace paludis
-{
- /**
- * Represents a use? ( ) dependency atom.
- *
- * \ingroup DepResolver
- */
- class UseDepAtom :
- public CompositeDepAtom,
- public Visitable<UseDepAtom, DepAtomVisitorTypes>
- {
- private:
- const UseFlagName _flag;
- const bool _inverse;
-
- public:
- /**
- * Constructor.
- */
- UseDepAtom(const UseFlagName &, bool);
-
- /**
- * Fetch our use flag name.
- */
- const UseFlagName & flag() const
- {
- return _flag;
- }
-
- /**
- * Fetch whether we are a ! flag.
- */
- bool inverse() const
- {
- return _inverse;
- }
-
- virtual const UseDepAtom * as_use_dep_atom() const PALUDIS_ATTRIBUTE((pure));
- };
-}
-
-#endif