aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-08 14:35:14 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-08 14:35:14 +0000
commitbd16d0222e4c401ebde224f1fa62eaf24356e173 (patch)
tree983a99c1b5776539de2e57f0be9a308300c2db67 /paludis
parentcbb5f4f9e3324460a9b7fcbb94941711df24df14 (diff)
downloadpaludis-bd16d0222e4c401ebde224f1fa62eaf24356e173.tar.gz
paludis-bd16d0222e4c401ebde224f1fa62eaf24356e173.tar.xz
Split out QueryDelegate into its own file. More Doxygen work.
Diffstat (limited to 'paludis')
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/match_package.hh39
-rw-r--r--paludis/query-fwd.hh11
-rw-r--r--paludis/query.cc39
-rw-r--r--paludis/query.hh125
-rw-r--r--paludis/query_delegate-fwd.hh34
-rw-r--r--paludis/query_delegate.cc58
-rw-r--r--paludis/query_delegate.hh112
8 files changed, 288 insertions, 131 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index b331b9728..bc928f94a 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -45,6 +45,7 @@ add(`package_id', `hh', `cc', `fwd', `se')
add(`paludis', `hh')
add(`qa', `hh', `cc', `fwd', `se', `sr')
add(`query', `hh', `cc', `fwd')
+add(`query_delegate', `hh', `cc', `fwd')
add(`query_visitor', `hh', `cc')
add(`range_rewriter', `hh', `cc', `test')
add(`report_task', `hh', `cc')
diff --git a/paludis/match_package.hh b/paludis/match_package.hh
index f6234bdc0..4aaa17f53 100644
--- a/paludis/match_package.hh
+++ b/paludis/match_package.hh
@@ -1,16 +1,33 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+/*
+ * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.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_MATCH_PACKAGE_HH
#define PALUDIS_GUARD_PALUDIS_MATCH_PACKAGE_HH 1
/** \file
- * Declare the match_package function.
+ * Declarations for match_package and match_package_in_set.
+ *
+ * \ingroup g_query
*
- * Do not merge this file into dep_spec. It will cause all sorts of horrible
- * circular dependency issues. Avoid including this file in headers if at all
- * possible.
+ * \section Examples
*
- * \ingroup grpmatchpackage
+ * - \ref example_match_package.cc "example_match_package.cc"
*/
#include <paludis/util/attributes.hh>
@@ -23,9 +40,10 @@
namespace paludis
{
/**
- * Return whether the specified spec matches the specified target.
+ * Return whether the specified PackageID matches the specified
+ * PackageDepSpec.
*
- * \ingroup grpmatchpackage
+ * \ingroup g_query
*/
bool match_package(
const Environment & env,
@@ -34,9 +52,12 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
/**
- * Return whether the specified spec matches the specified target, for heirarchies.
+ * Return whether the specified PackageID matches any of the items in the
+ * specified set.
+ *
+ * Named sets inside the set are expanded.
*
- * \ingroup grpmatchpackage
+ * \ingroup g_query
*/
bool match_package_in_set(
const Environment & env,
diff --git a/paludis/query-fwd.hh b/paludis/query-fwd.hh
index 71a244b66..25eebc9aa 100644
--- a/paludis/query-fwd.hh
+++ b/paludis/query-fwd.hh
@@ -23,9 +23,14 @@
#include <iosfwd>
#include <paludis/util/attributes.hh>
+/** \file
+ * Forward declarations for paludis/query.hh .
+ *
+ * \ingroup g_query
+ */
+
namespace paludis
{
- class QueryDelegate;
class Query;
namespace query
@@ -47,7 +52,7 @@ namespace paludis
*
* \see Query
* \see PackageDatabase::query
- * \ingroup grpquery
+ * \ingroup g_query
*/
Query operator& (const Query &, const Query &) PALUDIS_VISIBLE;
@@ -55,7 +60,7 @@ namespace paludis
* Output a human-readable description of a Query.
*
* \see Query
- * \ingroup grpquery
+ * \ingroup g_query
*/
std::ostream & operator<< (std::ostream &, const Query &) PALUDIS_VISIBLE;
}
diff --git a/paludis/query.cc b/paludis/query.cc
index 0ff70ebad..d0d62a31e 100644
--- a/paludis/query.cc
+++ b/paludis/query.cc
@@ -17,7 +17,8 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "query.hh"
+#include <paludis/query.hh>
+#include <paludis/query_delegate.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/tr1_functional.hh>
#include <paludis/util/sequence.hh>
@@ -36,47 +37,41 @@
using namespace paludis;
-QueryDelegate::QueryDelegate()
+Query::Query(tr1::shared_ptr<const QueryDelegate> d) :
+ _d(d)
{
}
-QueryDelegate::~QueryDelegate()
+Query::~Query()
{
}
tr1::shared_ptr<RepositoryNameSequence>
-QueryDelegate::repositories(const Environment &) const
+Query::repositories(const Environment & e) const
{
- return tr1::shared_ptr<RepositoryNameSequence>();
+ return _d->repositories(e);
}
tr1::shared_ptr<CategoryNamePartSet>
-QueryDelegate::categories(const Environment &, tr1::shared_ptr<const RepositoryNameSequence>) const
+Query::categories(const Environment & e, tr1::shared_ptr<const RepositoryNameSequence> r) const
{
- return tr1::shared_ptr<CategoryNamePartSet>();
+ return _d->categories(e, r);
}
tr1::shared_ptr<QualifiedPackageNameSet>
-QueryDelegate::packages(const Environment &, tr1::shared_ptr<const RepositoryNameSequence>,
- tr1::shared_ptr<const CategoryNamePartSet>) const
+Query::packages(const Environment & e,
+ tr1::shared_ptr<const RepositoryNameSequence> r,
+ tr1::shared_ptr<const CategoryNamePartSet> c) const
{
- return tr1::shared_ptr<QualifiedPackageNameSet>();
+ return _d->packages(e, r, c);
}
tr1::shared_ptr<PackageIDSequence>
-QueryDelegate::ids(const Environment &, tr1::shared_ptr<const RepositoryNameSequence>,
- tr1::shared_ptr<const QualifiedPackageNameSet>) const
-{
- return tr1::shared_ptr<PackageIDSequence>();
-}
-
-Query::Query(tr1::shared_ptr<const QueryDelegate> d) :
- _d(d)
-{
-}
-
-Query::~Query()
+Query::ids(const Environment & e,
+ tr1::shared_ptr<const RepositoryNameSequence> r,
+ tr1::shared_ptr<const QualifiedPackageNameSet> q) const
{
+ return _d->ids(e, r, q);
}
namespace
diff --git a/paludis/query.hh b/paludis/query.hh
index f35b825dc..f5fe1e9df 100644
--- a/paludis/query.hh
+++ b/paludis/query.hh
@@ -25,86 +25,25 @@
#include <paludis/package_id-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
+#include <paludis/query_delegate-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <iosfwd>
/** \file
- * Query and related classes.
+ * Declarations for Query and the various query:: classes.
*
- * \ingroup grpquery
+ * \ingroup g_query
+ *
+ * \section Examples
+ *
+ * - \ref example_query.cc "example_query.cc"
+ * - \ref example_query_delegate.cc "example_query_delegate.cc"
+ * - \ref example_match_package.cc "example_match_package.cc"
*/
namespace paludis
{
/**
- * A QueryDelegate subclass is used by Query to provide the information
- * needed by PackageDatabase::query.
- *
- * \see Query
- * \ingroup grpquery
- */
- class PALUDIS_VISIBLE QueryDelegate
- {
- protected:
- ///\name Basic operations
- ///\{
-
- QueryDelegate();
-
- public:
- virtual ~QueryDelegate();
-
- ///\}
-
- /**
- * Fetch the names of repositories potentially containing matches.
- * All returned repositories must exist.
- *
- * Default behaviour: return all repositories.
- */
- virtual tr1::shared_ptr<RepositoryNameSequence> repositories(const Environment &) const;
-
- /**
- * Fetch the names of categories potentially containing matches.
- *
- * Default behaviour: return all categories in the provided
- * repository collection.
- */
- virtual tr1::shared_ptr<CategoryNamePartSet> categories(const Environment &,
- tr1::shared_ptr<const RepositoryNameSequence>) const;
-
- /**
- * Fetch the names of packages potentially containing matches.
- *
- * Default behaviour: return all packages in the provided repository
- * in the provided categories.
- *
- * Note that some entries in the categories collection (but not in
- * the repositories collection) may not exist.
- */
- virtual tr1::shared_ptr<QualifiedPackageNameSet> packages(const Environment &,
- tr1::shared_ptr<const RepositoryNameSequence>,
- tr1::shared_ptr<const CategoryNamePartSet>) const;
-
- /**
- * Fetch the IDs of matching packages.
- *
- * Default behaviour: return all IDs in the provided packages.
- *
- * Note that some entries in the qualified package name collection
- * (but not in the repositories collection) may not exist.
- */
- virtual tr1::shared_ptr<PackageIDSequence> ids(const Environment &,
- tr1::shared_ptr<const RepositoryNameSequence>,
- tr1::shared_ptr<const QualifiedPackageNameSet>) const;
-
- /**
- * Fetch a string representation of our query.
- */
- virtual std::string as_human_readable_string() const = 0;
- };
-
- /**
* Parameter for a PackageDatabase query.
*
* Holds a QueryDelegate to perform actual operations, so that it can be
@@ -112,7 +51,7 @@ namespace paludis
*
* \see QueryDelegate
* \see PackageDatabase::query
- * \ingroup grpquery
+ * \ingroup g_query
* \nosubgrouping
*/
class PALUDIS_VISIBLE Query
@@ -137,30 +76,18 @@ namespace paludis
///\name Delegate-implemented functions
///\{
- tr1::shared_ptr<RepositoryNameSequence> repositories(const Environment & e) const
- {
- return _d->repositories(e);
- }
+ tr1::shared_ptr<RepositoryNameSequence> repositories(const Environment & e) const;
tr1::shared_ptr<CategoryNamePartSet> categories(const Environment & e,
- tr1::shared_ptr<const RepositoryNameSequence> r) const
- {
- return _d->categories(e, r);
- }
+ tr1::shared_ptr<const RepositoryNameSequence> r) const;
tr1::shared_ptr<QualifiedPackageNameSet> packages(const Environment & e,
tr1::shared_ptr<const RepositoryNameSequence> r,
- tr1::shared_ptr<const CategoryNamePartSet> c) const
- {
- return _d->packages(e, r, c);
- }
+ tr1::shared_ptr<const CategoryNamePartSet> c) const;
tr1::shared_ptr<PackageIDSequence> ids(const Environment & e,
tr1::shared_ptr<const RepositoryNameSequence> r,
- tr1::shared_ptr<const QualifiedPackageNameSet> q) const
- {
- return _d->ids(e, r, q);
- }
+ tr1::shared_ptr<const QualifiedPackageNameSet> q) const;
///\}
};
@@ -169,7 +96,7 @@ namespace paludis
* Various Query classes.
*
* \see Query
- * \ingroup grpquery
+ * \ingroup g_query
*/
namespace query
{
@@ -178,7 +105,7 @@ namespace paludis
*
* \see Query
* \see PackageDatabase::query
- * \ingroup grpquery
+ * \ingroup g_query
* \nosubgrouping
*/
class PALUDIS_VISIBLE Matches :
@@ -197,7 +124,8 @@ namespace paludis
* Fetch packages with a given package name.
*
* \see Query
- * \ingroup grpquerybase::query
+ * \see PackageDatabase::query
+ * \ingroup g_query
* \nosubgrouping
*/
class PALUDIS_VISIBLE Package :
@@ -216,7 +144,8 @@ namespace paludis
* Fetch packages in a given repository.
*
* \see Query
- * \ingroup grpquerybase::query
+ * \see PackageDatabase::query
+ * \ingroup g_query
* \nosubgrouping
*/
class PALUDIS_VISIBLE Repository :
@@ -235,7 +164,8 @@ namespace paludis
* Fetch packages in a given category.
*
* \see Query
- * \ingroup grpquerybase::query
+ * \see PackageDatabase::query
+ * \ingroup g_query
* \nosubgrouping
*/
class PALUDIS_VISIBLE Category :
@@ -254,7 +184,8 @@ namespace paludis
* Fetch packages that are not masked.
*
* \see Query
- * \ingroup grpquery
+ * \see PackageDatabase::query
+ * \ingroup g_query
* \nosubgrouping
*/
class PALUDIS_VISIBLE NotMasked :
@@ -274,7 +205,7 @@ namespace paludis
*
* \see Query
* \see PackageDatabase::query
- * \ingroup grpquery
+ * \ingroup g_query
* \nosubgrouping
*/
template <typename A_>
@@ -300,7 +231,7 @@ namespace paludis
*
* \see Query
* \see PackageDatabase::query
- * \ingroup grpquery
+ * \ingroup g_query
* \nosubgrouping
*/
template <typename A_>
@@ -321,7 +252,7 @@ namespace paludis
*
* \see Query
* \see PackageDatabase::query
- * \ingroup grpquery
+ * \ingroup g_query
* \nosubgrouping
*/
class PALUDIS_VISIBLE InstalledAtRoot :
@@ -341,7 +272,7 @@ namespace paludis
*
* \see Query
* \see PackageDatabase::query
- * \ingroup grpquery
+ * \ingroup g_query
* \nosubgrouping
*/
class PALUDIS_VISIBLE All :
diff --git a/paludis/query_delegate-fwd.hh b/paludis/query_delegate-fwd.hh
new file mode 100644
index 000000000..6473265d8
--- /dev/null
+++ b/paludis/query_delegate-fwd.hh
@@ -0,0 +1,34 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.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_QUERY_DELEGATE_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_QUERY_DELEGATE_FWD_HH 1
+
+/** \file
+ * Forward declarations for paludis/query_delegate.hh .
+ *
+ * \ingroup g_query
+ */
+
+namespace paludis
+{
+ class QueryDelegate;
+}
+
+#endif
diff --git a/paludis/query_delegate.cc b/paludis/query_delegate.cc
new file mode 100644
index 000000000..1c94fa428
--- /dev/null
+++ b/paludis/query_delegate.cc
@@ -0,0 +1,58 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.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 <paludis/query_delegate.hh>
+
+using namespace paludis;
+
+QueryDelegate::QueryDelegate()
+{
+}
+
+QueryDelegate::~QueryDelegate()
+{
+}
+
+tr1::shared_ptr<RepositoryNameSequence>
+QueryDelegate::repositories(const Environment &) const
+{
+ return tr1::shared_ptr<RepositoryNameSequence>();
+}
+
+tr1::shared_ptr<CategoryNamePartSet>
+QueryDelegate::categories(const Environment &, tr1::shared_ptr<const RepositoryNameSequence>) const
+{
+ return tr1::shared_ptr<CategoryNamePartSet>();
+}
+
+tr1::shared_ptr<QualifiedPackageNameSet>
+QueryDelegate::packages(const Environment &, tr1::shared_ptr<const RepositoryNameSequence>,
+ tr1::shared_ptr<const CategoryNamePartSet>) const
+{
+ return tr1::shared_ptr<QualifiedPackageNameSet>();
+}
+
+tr1::shared_ptr<PackageIDSequence>
+QueryDelegate::ids(const Environment &, tr1::shared_ptr<const RepositoryNameSequence>,
+ tr1::shared_ptr<const QualifiedPackageNameSet>) const
+{
+ return tr1::shared_ptr<PackageIDSequence>();
+}
+
+
diff --git a/paludis/query_delegate.hh b/paludis/query_delegate.hh
new file mode 100644
index 000000000..312b14b96
--- /dev/null
+++ b/paludis/query_delegate.hh
@@ -0,0 +1,112 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.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_QUERY_DELEGATE_HH
+#define PALUDIS_GUARD_PALUDIS_QUERY_DELEGATE_HH 1
+
+#include <paludis/name-fwd.hh>
+#include <paludis/query_delegate-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/query_delegate-fwd.hh>
+
+/** \file
+ * Declarations for QueryDelegate.
+ *
+ * \ingroup g_query
+ *
+ * \section Examples
+ *
+ * - \ref example_query_delegate.cc "example_query_delegate.cc"
+ * - \ref example_query.cc "example_query.cc"
+ * - \ref example_match_package.cc "example_match_package.cc"
+ */
+
+namespace paludis
+{
+ /**
+ * A QueryDelegate subclass is used by Query to provide the information
+ * needed by PackageDatabase::query.
+ *
+ * \see Query
+ * \ingroup g_query
+ */
+ class PALUDIS_VISIBLE QueryDelegate
+ {
+ protected:
+ ///\name Basic operations
+ ///\{
+
+ QueryDelegate();
+
+ public:
+ virtual ~QueryDelegate();
+
+ ///\}
+
+ /**
+ * Fetch the names of repositories potentially containing matches.
+ * All returned repositories must exist.
+ *
+ * Default behaviour: return all repositories.
+ */
+ virtual tr1::shared_ptr<RepositoryNameSequence> repositories(const Environment &) const;
+
+ /**
+ * Fetch the names of categories potentially containing matches.
+ *
+ * Default behaviour: return all categories in the provided
+ * repository collection.
+ */
+ virtual tr1::shared_ptr<CategoryNamePartSet> categories(const Environment &,
+ tr1::shared_ptr<const RepositoryNameSequence>) const;
+
+ /**
+ * Fetch the names of packages potentially containing matches.
+ *
+ * Default behaviour: return all packages in the provided repository
+ * in the provided categories.
+ *
+ * Note that some entries in the categories collection (but not in
+ * the repositories collection) may not exist.
+ */
+ virtual tr1::shared_ptr<QualifiedPackageNameSet> packages(const Environment &,
+ tr1::shared_ptr<const RepositoryNameSequence>,
+ tr1::shared_ptr<const CategoryNamePartSet>) const;
+
+ /**
+ * Fetch the IDs of matching packages.
+ *
+ * Default behaviour: return all IDs in the provided packages.
+ *
+ * Note that some entries in the qualified package name collection
+ * (but not in the repositories collection) may not exist.
+ */
+ virtual tr1::shared_ptr<PackageIDSequence> ids(const Environment &,
+ tr1::shared_ptr<const RepositoryNameSequence>,
+ tr1::shared_ptr<const QualifiedPackageNameSet>) const;
+
+ /**
+ * Fetch a string representation of our query.
+ */
+ virtual std::string as_human_readable_string() const = 0;
+ };
+}
+
+#endif