paludis Version 3.0.2
The one true package mangler
fake_repository_base.hh
Go to the documentation of this file.
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
5 *
6 * This file is part of the Paludis package manager. Paludis is free software;
7 * you can redistribute it and/or modify it under the terms of the GNU General
8 * Public License version 2, as published by the Free Software Foundation.
9 *
10 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef PALUDIS_GUARD_PALUDIS_FAKE_REPOSITORY_BASE_HH
21#define PALUDIS_GUARD_PALUDIS_FAKE_REPOSITORY_BASE_HH 1
22
23#include <paludis/repository.hh>
24#include <paludis/action-fwd.hh>
25#include <paludis/util/pimp.hh>
26
27/** \file
28 * Declarations for the FakeRepositoryBase class.
29 *
30 * \ingroup grpfakerepository
31 */
32
33namespace paludis
34{
35 class FakePackageID;
36
37 /**
38 * A FakeRepositoryBase is a Repository subclass whose subclasses are used for
39 * various test cases.
40 *
41 * \see FakeRepository
42 * \see FakeInstalledRepository
43 * \ingroup grpfakerepository
44 */
46 public Repository,
47 public std::enable_shared_from_this<FakeRepositoryBase>
48 {
49 private:
51
52 protected:
53 /**
54 * Constructor.
55 */
57 const RepositoryCapabilities & caps);
58
59 void need_keys_added() const override;
60
61 public:
62 /**
63 * Destructor.
64 */
66
67 /**
68 * Add a category.
69 */
71
72 /**
73 * Add a package, and a category if necessary.
74 */
76
77 /**
78 * Add a version, and a package and category if necessary, and set some
79 * default values for its metadata, and return said metadata.
80 */
81 std::shared_ptr<FakePackageID> add_version(const QualifiedPackageName &, const VersionSpec &);
82
83 /**
84 * Add a version, and a package and category if necessary, and set some
85 * default values for its metadata, and return said metadata (convenience
86 * overload taking strings).
87 */
88 std::shared_ptr<FakePackageID> add_version(const std::string & c, const std::string & p,
89 const std::string & v);
90
91 void invalidate() override;
92
93 /**
94 * Fetch our associated environment.
95 */
96 const Environment * environment() const;
97
98 /* Repository */
99
100 std::shared_ptr<const PackageIDSequence> package_ids(
101 const QualifiedPackageName &, const RepositoryContentMayExcludes &) const
102 override PALUDIS_ATTRIBUTE((warn_unused_result));
103
104 std::shared_ptr<const QualifiedPackageNameSet> package_names(
105 const CategoryNamePart &, const RepositoryContentMayExcludes &) const
106 override PALUDIS_ATTRIBUTE((warn_unused_result));
107
108 std::shared_ptr<const CategoryNamePartSet> category_names(const RepositoryContentMayExcludes &) const
109 override PALUDIS_ATTRIBUTE((warn_unused_result));
110
111 bool has_package_named(const QualifiedPackageName &, const RepositoryContentMayExcludes &) const
112 override PALUDIS_ATTRIBUTE((warn_unused_result));
113
114 bool has_category_named(const CategoryNamePart &, const RepositoryContentMayExcludes &) const
115 override PALUDIS_ATTRIBUTE((warn_unused_result));
116
117 bool sync(const std::string &, const std::string &, const std::shared_ptr<OutputManager> &) const override;
118
119 ///\name Set methods
120 ///\{
121
122 void populate_sets() const override;
123
124 ///\}
125
126 HookResult perform_hook(const Hook & hook, const std::shared_ptr<OutputManager> &) override;
127 };
128}
129
130
131#endif
Definition environment.hh:203
Definition fake_package_id.hh:216
std::shared_ptr< const CategoryNamePartSet > category_names(const RepositoryContentMayExcludes &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
void invalidate() override
const Environment * environment() const
std::shared_ptr< const PackageIDSequence > package_ids(const QualifiedPackageName &, const RepositoryContentMayExcludes &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
FakeRepositoryBase(const Environment *const env, const RepositoryName &name, const RepositoryCapabilities &caps)
void add_category(const CategoryNamePart &)
bool has_category_named(const CategoryNamePart &, const RepositoryContentMayExcludes &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
void need_keys_added() const override
void add_package(const QualifiedPackageName &)
std::shared_ptr< FakePackageID > add_version(const QualifiedPackageName &, const VersionSpec &)
bool sync(const std::string &, const std::string &, const std::shared_ptr< OutputManager > &) const override
bool has_package_named(const QualifiedPackageName &, const RepositoryContentMayExcludes &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
HookResult perform_hook(const Hook &hook, const std::shared_ptr< OutputManager > &) override
void populate_sets() const override
std::shared_ptr< FakePackageID > add_version(const std::string &c, const std::string &p, const std::string &v)
std::shared_ptr< const QualifiedPackageNameSet > package_names(const CategoryNamePart &, const RepositoryContentMayExcludes &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
Definition hook.hh:75
Definition pimp.hh:52
Definition name.hh:112
const RepositoryName name() const noexcept PALUDIS_ATTRIBUTE((warn_unused_result))
Definition version_spec.hh:109
WrappedValue< CategoryNamePartTag > CategoryNamePart
Definition name-fwd.hh:61
WrappedValue< RepositoryNameTag > RepositoryName
Definition name-fwd.hh:105
#define PALUDIS_ATTRIBUTE(x)
Definition attributes.hh:53
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition about_metadata-fwd.hh:24
Definition hook.hh:62
Definition repository.hh:94