paludis Version 3.0.2
The one true package mangler
test_environment.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, 2014 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_TEST_ENVIRONMENT_HH
21#define PALUDIS_GUARD_PALUDIS_TEST_ENVIRONMENT_HH 1
22
25#include <paludis/util/pimp.hh>
26
27/** \file
28 * Declarations for the TestEnvironment class.
29 *
30 * \ingroup grptestenvironment
31 */
32
33namespace paludis
34{
35 /**
36 * A TestEnvironment is an environment used during testing that lets us
37 * control all the options rather than reading them from configuration
38 * files.
39 *
40 * \ingroup grptestenvironment
41 */
42 class PALUDIS_VISIBLE TestEnvironment :
43 public EnvironmentImplementation
44 {
45 private:
47
48 protected:
49 void need_keys_added() const override;
50 void populate_sets() const override;
51
52 public:
53 ///\name Basic operations
54 ///\{
55
56 TestEnvironment();
57 TestEnvironment(bool);
58 TestEnvironment(const FSPath &);
59 TestEnvironment(const FSPath &, bool);
60
61 ~TestEnvironment() override;
62
63 ///\}
64
65 bool accept_license(const std::string &, const std::shared_ptr<const PackageID> &) const
66 override PALUDIS_ATTRIBUTE((warn_unused_result));
67
68 bool accept_keywords(const std::shared_ptr<const KeywordNameSet> &, const std::shared_ptr<const PackageID> &) const
69 override PALUDIS_ATTRIBUTE((warn_unused_result));
70
71 const std::shared_ptr<const Mask> mask_for_user(const std::shared_ptr<const PackageID> &, const bool) const
72 override PALUDIS_ATTRIBUTE((warn_unused_result));
73
74 bool unmasked_by_user(const std::shared_ptr<const PackageID> &, const std::string &) const
75 override PALUDIS_ATTRIBUTE((warn_unused_result));
76
77 std::shared_ptr<const FSPathSequence> hook_dirs() const
78 override PALUDIS_ATTRIBUTE((warn_unused_result));
79
80 std::string reduced_username() const override;
81
82 uid_t reduced_uid() const override;
83
84 gid_t reduced_gid() const override;
85
86 std::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const
87 override PALUDIS_ATTRIBUTE((warn_unused_result));
88
90 const Hook &,
91 const std::shared_ptr<OutputManager> &) const
92 override PALUDIS_ATTRIBUTE((warn_unused_result));
93
94 bool add_to_world(const QualifiedPackageName &) const override;
95
96 bool add_to_world(const SetName &) const override;
97
98 bool remove_from_world(const QualifiedPackageName &) const override;
99
100 bool remove_from_world(const SetName &) const override;
101
102 const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const override;
103 const std::shared_ptr<const MetadataValueKey<FSPath> > config_location_key() const override;
104 const std::shared_ptr<const MetadataValueKey<FSPath> > preferred_root_key() const override;
105 const std::shared_ptr<const MetadataValueKey<FSPath> > system_root_key() const override;
106
108 const std::shared_ptr<const PackageID> & from_id,
109 const PackageDepSpec & spec) const override;
110
112 const std::shared_ptr<const PackageID> &,
113 const std::shared_ptr<const Choice> &,
115 ) const
116 override PALUDIS_ATTRIBUTE((warn_unused_result));
117
118 const std::string value_for_choice_parameter(
119 const std::shared_ptr<const PackageID> &,
120 const std::shared_ptr<const Choice> &,
122 ) const
123 override PALUDIS_ATTRIBUTE((warn_unused_result));
124
126 const std::shared_ptr<const PackageID> &,
127 const std::shared_ptr<const Choice> &
128 ) const
129 override PALUDIS_ATTRIBUTE((warn_unused_result));
130
131 const std::shared_ptr<OutputManager> create_output_manager(
132 const CreateOutputManagerInfo &) const override;
133
134 void set_want_choice_enabled(const ChoicePrefixName &, const UnprefixedChoiceName &, const Tribool);
135
137 const FSPath &) override PALUDIS_ATTRIBUTE((noreturn));
138
140 const PackageDepSpec &, const QualifiedPackageName &) const override;
141
142 void set_system_root(const FSPath &);
143 };
144}
145
146#endif
Definition choice.hh:234
Definition create_output_manager_info.hh:48
Definition fs_path.hh:34
Definition hook.hh:75
Definition metadata_key.hh:229
Definition output_manager.hh:30
Definition dep_spec.hh:348
Definition package_id.hh:99
Definition pimp.hh:52
Definition name.hh:112
Definition repository.hh:249
Definition set.hh:51
std::string reduced_username() const override
void update_config_files_for_package_move(const PackageDepSpec &, const QualifiedPackageName &) const override
Tribool interest_in_suggestion(const std::shared_ptr< const PackageID > &from_id, const PackageDepSpec &spec) const override
const std::shared_ptr< const MetadataValueKey< std::string > > format_key() const override
const std::shared_ptr< const Mask > mask_for_user(const std::shared_ptr< const PackageID > &, const bool) const override PALUDIS_ATTRIBUTE((warn_unused_result))
void need_keys_added() const override
std::shared_ptr< const MirrorsSequence > mirrors(const std::string &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::shared_ptr< Repository > repository_from_new_config_file(const FSPath &) override PALUDIS_ATTRIBUTE((noreturn))
bool accept_keywords(const std::shared_ptr< const KeywordNameSet > &, const std::shared_ptr< const PackageID > &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::shared_ptr< const MetadataValueKey< FSPath > > config_location_key() const override
bool unmasked_by_user(const std::shared_ptr< const PackageID > &, const std::string &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
std::shared_ptr< const FSPathSequence > hook_dirs() const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::shared_ptr< const MetadataValueKey< FSPath > > preferred_root_key() const override
HookResult perform_hook(const Hook &, const std::shared_ptr< OutputManager > &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
gid_t reduced_gid() const override
const std::string value_for_choice_parameter(const std::shared_ptr< const PackageID > &, const std::shared_ptr< const Choice > &, const UnprefixedChoiceName &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
bool remove_from_world(const QualifiedPackageName &) const override
const Tribool want_choice_enabled(const std::shared_ptr< const PackageID > &, const std::shared_ptr< const Choice > &, const UnprefixedChoiceName &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
uid_t reduced_uid() const override
bool accept_license(const std::string &, const std::shared_ptr< const PackageID > &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::shared_ptr< const MetadataValueKey< FSPath > > system_root_key() const override
bool add_to_world(const QualifiedPackageName &) const override
const std::shared_ptr< OutputManager > create_output_manager(const CreateOutputManagerInfo &) const override
std::shared_ptr< const Set< UnprefixedChoiceName > > known_choice_value_names(const std::shared_ptr< const PackageID > &, const std::shared_ptr< const Choice > &) const override PALUDIS_ATTRIBUTE((warn_unused_result))
Definition tribool.hh:28
WrappedValue< UnprefixedChoiceNameTag > UnprefixedChoiceName
Definition choice-fwd.hh:73
WrappedValue< ChoicePrefixNameTag > ChoicePrefixName
Definition choice-fwd.hh:57
Sequence< std::string > MirrorsSequence
Definition environment-fwd.hh:41
WrappedValue< SetNameTag > SetName
Definition name-fwd.hh:131
#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