aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-06-01 17:49:26 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-06-01 17:49:26 +0000
commit22a63d94cdbcf4b29d64a55b92eec0aa6f564a54 (patch)
tree5967af5309eaed9d254d19df06b5ec39911aac09
parent401165692d807f4b9d0df756fd9b500408039092 (diff)
downloadpaludis-22a63d94cdbcf4b29d64a55b92eec0aa6f564a54.tar.gz
paludis-22a63d94cdbcf4b29d64a55b92eec0aa6f564a54.tar.xz
Move FilterHandler and SelectionHandler into public headers.
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/filter.cc69
-rw-r--r--paludis/filter.hh3
-rw-r--r--paludis/filter_handler-fwd.hh29
-rw-r--r--paludis/filter_handler.cc57
-rw-r--r--paludis/filter_handler.hh83
-rw-r--r--paludis/generator_handler-fwd.hh4
-rw-r--r--paludis/selection.cc25
-rw-r--r--paludis/selection.hh3
-rw-r--r--paludis/selection_handler-fwd.hh28
-rw-r--r--paludis/selection_handler.cc30
-rw-r--r--paludis/selection_handler.hh59
12 files changed, 298 insertions, 94 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index ca337b4..272fef7 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -31,6 +31,7 @@ add(`environment', `hh', `fwd', `cc')
add(`environment_implementation', `hh', `cc')
add(`environment_maker', `hh', `cc')
add(`filter', `hh', `cc', `fwd', `test')
+add(`filter_handler', `hh', `cc', `fwd')
add(`filtered_generator', `hh', `cc', `fwd', `test')
add(`find_unused_packages_task', `hh', `cc')
add(`fuzzy_finder', `hh', `cc', `test')
@@ -65,6 +66,7 @@ add(`repository', `hh', `fwd', `cc')
add(`repository_maker', `hh', `cc')
add(`repository_name_cache', `hh', `cc', `test', `testscript')
add(`selection', `hh', `cc', `fwd', `test')
+add(`selection_handler', `hh', `cc', `fwd')
add(`set_file', `hh', `cc', `se', `sr', `test', `testscript')
add(`show_suggest_visitor', `hh', `cc')
add(`slot_requirement', `hh', `fwd', `cc')
diff --git a/paludis/filter.cc b/paludis/filter.cc
index 5049d89..d66c743 100644
--- a/paludis/filter.cc
+++ b/paludis/filter.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/filter.hh>
+#include <paludis/filter_handler.hh>
#include <paludis/name.hh>
#include <paludis/action.hh>
#include <paludis/environment.hh>
@@ -37,32 +38,6 @@ using namespace paludis;
namespace paludis
{
- class PALUDIS_VISIBLE FilterHandler
- {
- public:
- virtual ~FilterHandler() = 0;
-
- virtual std::string as_string() const = 0;
-
- virtual std::tr1::shared_ptr<const RepositoryNameSet> repositories(
- const Environment * const,
- const std::tr1::shared_ptr<const RepositoryNameSet> &) const = 0;
-
- virtual std::tr1::shared_ptr<const CategoryNamePartSet> categories(
- const Environment * const,
- const std::tr1::shared_ptr<const RepositoryNameSet> &,
- const std::tr1::shared_ptr<const CategoryNamePartSet> &) const = 0;
-
- virtual std::tr1::shared_ptr<const QualifiedPackageNameSet> packages(
- const Environment * const,
- const std::tr1::shared_ptr<const RepositoryNameSet> &,
- const std::tr1::shared_ptr<const QualifiedPackageNameSet> &) const = 0;
-
- virtual std::tr1::shared_ptr<const PackageIDSet> ids(
- const Environment * const,
- const std::tr1::shared_ptr<const PackageIDSet> &) const = 0;
- };
-
template <>
struct Implementation<Filter>
{
@@ -75,10 +50,6 @@ namespace paludis
};
}
-FilterHandler::~FilterHandler()
-{
-}
-
Filter::Filter(const std::tr1::shared_ptr<const FilterHandler> & h) :
PrivateImplementationPattern<Filter>(new Implementation<Filter>(h))
{
@@ -144,38 +115,8 @@ Filter::as_string() const
namespace
{
struct AllFilterHandler :
- FilterHandler
+ AllFilterHandlerBase
{
- virtual std::tr1::shared_ptr<const RepositoryNameSet> repositories(
- const Environment * const,
- const std::tr1::shared_ptr<const RepositoryNameSet> & s) const
- {
- return s;
- }
-
- virtual std::tr1::shared_ptr<const CategoryNamePartSet> categories(
- const Environment * const,
- const std::tr1::shared_ptr<const RepositoryNameSet> &,
- const std::tr1::shared_ptr<const CategoryNamePartSet> & s) const
- {
- return s;
- }
-
- virtual std::tr1::shared_ptr<const QualifiedPackageNameSet> packages(
- const Environment * const,
- const std::tr1::shared_ptr<const RepositoryNameSet> &,
- const std::tr1::shared_ptr<const QualifiedPackageNameSet> & s) const
- {
- return s;
- }
-
- virtual std::tr1::shared_ptr<const PackageIDSet> ids(
- const Environment * const,
- const std::tr1::shared_ptr<const PackageIDSet> & s) const
- {
- return s;
- }
-
virtual std::string as_string() const
{
return "all matches";
@@ -184,7 +125,7 @@ namespace
template <typename A_>
struct SupportsActionFilterHandler :
- AllFilterHandler
+ AllFilterHandlerBase
{
virtual std::tr1::shared_ptr<const RepositoryNameSet> repositories(
const Environment * const env,
@@ -225,7 +166,7 @@ namespace
};
struct NotMaskedFilterHandler :
- AllFilterHandler
+ AllFilterHandlerBase
{
virtual std::tr1::shared_ptr<const PackageIDSet> ids(
const Environment * const,
@@ -248,7 +189,7 @@ namespace
};
struct InstalledAtRootFilterHandler :
- AllFilterHandler
+ AllFilterHandlerBase
{
const FSEntry root;
diff --git a/paludis/filter.hh b/paludis/filter.hh
index c736926..1f17913 100644
--- a/paludis/filter.hh
+++ b/paludis/filter.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_FILTER_HH 1
#include <paludis/filter-fwd.hh>
+#include <paludis/filter_handler-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/set-fwd.hh>
@@ -33,8 +34,6 @@
namespace paludis
{
- class FilterHandler;
-
class PALUDIS_VISIBLE Filter :
private PrivateImplementationPattern<Filter>
{
diff --git a/paludis/filter_handler-fwd.hh b/paludis/filter_handler-fwd.hh
new file mode 100644
index 0000000..c53c561
--- /dev/null
+++ b/paludis/filter_handler-fwd.hh
@@ -0,0 +1,29 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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_FILTER_HANDLER_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_FILTER_HANDLER_FWD_HH 1
+
+namespace paludis
+{
+ class FilterHandler;
+ class AllFilterHandlerBase;
+}
+
+#endif
diff --git a/paludis/filter_handler.cc b/paludis/filter_handler.cc
new file mode 100644
index 0000000..b1e58fb
--- /dev/null
+++ b/paludis/filter_handler.cc
@@ -0,0 +1,57 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 David Leverton
+ *
+ * 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 <paludis/filter_handler.hh>
+
+using namespace paludis;
+
+FilterHandler::~FilterHandler()
+{
+}
+
+std::tr1::shared_ptr<const RepositoryNameSet>
+AllFilterHandlerBase::repositories(const Environment * const,
+ const std::tr1::shared_ptr<const RepositoryNameSet> & s) const
+{
+ return s;
+}
+
+std::tr1::shared_ptr<const CategoryNamePartSet>
+AllFilterHandlerBase::categories(const Environment * const,
+ const std::tr1::shared_ptr<const RepositoryNameSet> &,
+ const std::tr1::shared_ptr<const CategoryNamePartSet> & s) const
+{
+ return s;
+}
+
+std::tr1::shared_ptr<const QualifiedPackageNameSet>
+AllFilterHandlerBase::packages(const Environment * const,
+ const std::tr1::shared_ptr<const RepositoryNameSet> &,
+ const std::tr1::shared_ptr<const QualifiedPackageNameSet> & s) const
+{
+ return s;
+}
+
+std::tr1::shared_ptr<const PackageIDSet>
+AllFilterHandlerBase::ids(const Environment * const,
+ const std::tr1::shared_ptr<const PackageIDSet> & s) const
+{
+ return s;
+}
+
diff --git a/paludis/filter_handler.hh b/paludis/filter_handler.hh
new file mode 100644
index 0000000..18c50df
--- /dev/null
+++ b/paludis/filter_handler.hh
@@ -0,0 +1,83 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008 David Leverton
+ *
+ * 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_FILTER_HANDLER_HH
+#define PALUDIS_GUARD_PALUDIS_FILTER_HANDLER_HH 1
+
+#include <paludis/filter_handler-fwd.hh>
+#include <paludis/name-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <tr1/memory>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE FilterHandler
+ {
+ public:
+ virtual ~FilterHandler() = 0;
+
+ virtual std::string as_string() const = 0;
+
+ virtual std::tr1::shared_ptr<const RepositoryNameSet> repositories(
+ const Environment * const,
+ const std::tr1::shared_ptr<const RepositoryNameSet> &) const = 0;
+
+ virtual std::tr1::shared_ptr<const CategoryNamePartSet> categories(
+ const Environment * const,
+ const std::tr1::shared_ptr<const RepositoryNameSet> &,
+ const std::tr1::shared_ptr<const CategoryNamePartSet> &) const = 0;
+
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameSet> packages(
+ const Environment * const,
+ const std::tr1::shared_ptr<const RepositoryNameSet> &,
+ const std::tr1::shared_ptr<const QualifiedPackageNameSet> &) const = 0;
+
+ virtual std::tr1::shared_ptr<const PackageIDSet> ids(
+ const Environment * const,
+ const std::tr1::shared_ptr<const PackageIDSet> &) const = 0;
+ };
+
+ class PALUDIS_VISIBLE AllFilterHandlerBase :
+ public FilterHandler
+ {
+ public:
+ virtual std::tr1::shared_ptr<const RepositoryNameSet> repositories(
+ const Environment * const,
+ const std::tr1::shared_ptr<const RepositoryNameSet> &) const;
+
+ virtual std::tr1::shared_ptr<const CategoryNamePartSet> categories(
+ const Environment * const,
+ const std::tr1::shared_ptr<const RepositoryNameSet> &,
+ const std::tr1::shared_ptr<const CategoryNamePartSet> &) const;
+
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameSet> packages(
+ const Environment * const,
+ const std::tr1::shared_ptr<const RepositoryNameSet> &,
+ const std::tr1::shared_ptr<const QualifiedPackageNameSet> &) const;
+
+ virtual std::tr1::shared_ptr<const PackageIDSet> ids(
+ const Environment * const,
+ const std::tr1::shared_ptr<const PackageIDSet> &) const;
+ };
+}
+
+#endif
diff --git a/paludis/generator_handler-fwd.hh b/paludis/generator_handler-fwd.hh
index e8fd081..976eda3 100644
--- a/paludis/generator_handler-fwd.hh
+++ b/paludis/generator_handler-fwd.hh
@@ -22,8 +22,8 @@
namespace paludis
{
- struct GeneratorHandler;
- struct AllGeneratorHandlerBase;
+ class GeneratorHandler;
+ class AllGeneratorHandlerBase;
}
#endif
diff --git a/paludis/selection.cc b/paludis/selection.cc
index 9f9e7cc..738622d 100644
--- a/paludis/selection.cc
+++ b/paludis/selection.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/selection.hh>
+#include <paludis/selection_handler.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/set.hh>
@@ -51,26 +52,6 @@ DidNotGetExactlyOneError::DidNotGetExactlyOneError(const std::string & s, const
namespace paludis
{
- class SelectionHandler :
- private InstantiationPolicy<SelectionHandler, instantiation_method::NonCopyableTag>
- {
- protected:
- const FilteredGenerator _fg;
-
- SelectionHandler(const FilteredGenerator & g) :
- _fg(g)
- {
- }
-
- public:
- virtual ~SelectionHandler() = 0;
-
- virtual std::string as_string() const = 0;
-
- virtual std::tr1::shared_ptr<PackageIDSequence> perform_select(const Environment * const) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
template <>
struct Implementation<Selection>
{
@@ -112,10 +93,6 @@ Selection::perform_select(const Environment * const env) const
return _imp->handler->perform_select(env);
}
-SelectionHandler::~SelectionHandler()
-{
-}
-
std::string
Selection::as_string() const
{
diff --git a/paludis/selection.hh b/paludis/selection.hh
index f169a42..c503742 100644
--- a/paludis/selection.hh
+++ b/paludis/selection.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_SELECTION_HH 1
#include <paludis/selection-fwd.hh>
+#include <paludis/selection_handler-fwd.hh>
#include <paludis/filtered_generator-fwd.hh>
#include <paludis/filter-fwd.hh>
#include <paludis/generator-fwd.hh>
@@ -34,8 +35,6 @@
namespace paludis
{
- class SelectionHandler;
-
class DidNotGetExactlyOneError :
public Exception
{
diff --git a/paludis/selection_handler-fwd.hh b/paludis/selection_handler-fwd.hh
new file mode 100644
index 0000000..5a52b48
--- /dev/null
+++ b/paludis/selection_handler-fwd.hh
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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_SELECTION_HANDLER_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_SELECTION_HANDLER_FWD_HH 1
+
+namespace paludis
+{
+ class SelectionHandler;
+}
+
+#endif
diff --git a/paludis/selection_handler.cc b/paludis/selection_handler.cc
new file mode 100644
index 0000000..68efb0a
--- /dev/null
+++ b/paludis/selection_handler.cc
@@ -0,0 +1,30 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 David Leverton
+ *
+ * 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 <paludis/selection_handler.hh>
+#include <paludis/util/instantiation_policy-impl.hh>
+
+using namespace paludis;
+
+SelectionHandler::~SelectionHandler()
+{
+}
+
+template class InstantiationPolicy<SelectionHandler, instantiation_method::NonCopyableTag>;
+
diff --git a/paludis/selection_handler.hh b/paludis/selection_handler.hh
new file mode 100644
index 0000000..08ed6bc
--- /dev/null
+++ b/paludis/selection_handler.hh
@@ -0,0 +1,59 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008 David Leverton
+ *
+ * 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_FILTER_HANDLER_HH
+#define PALUDIS_GUARD_PALUDIS_FILTER_HANDLER_HH 1
+
+#include <paludis/selection_handler-fwd.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/instantiation_policy.hh>
+#include <tr1/memory>
+
+namespace paludis
+{
+ class SelectionHandler :
+ private InstantiationPolicy<SelectionHandler, instantiation_method::NonCopyableTag>
+ {
+ protected:
+ const FilteredGenerator _fg;
+
+ SelectionHandler(const FilteredGenerator & g) :
+ _fg(g)
+ {
+ }
+
+ public:
+ virtual ~SelectionHandler() = 0;
+
+ virtual std::string as_string() const = 0;
+
+ virtual std::tr1::shared_ptr<PackageIDSequence> perform_select(const Environment * const) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class InstantiationPolicy<SelectionHandler, instantiation_method::NonCopyableTag>;
+#endif
+}
+
+#endif