paludis  Version 2.6.0
environment_implementation.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_ENVIRONMENT_IMPLEMENTATION_HH
21 #define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_IMPLEMENTATION_HH 1
22 
23 #include <paludis/environment.hh>
25 
26 /** \file
27  * Declarations for the Environment class.
28  *
29  * \ingroup g_environment
30  *
31  * \section Examples
32  *
33  * - None at this time. The EnvironmentImplementation class is of no relevance
34  * to clients.
35  */
36 
37 namespace paludis
38 {
39  /**
40  * Simplifies implementing the Environment interface.
41  *
42  * Most Environment subclasses derive from this class, rather than directly
43  * from the abstract base. It provides default implementations for many
44  * methods.
45  *
46  * \ingroup g_environment
47  * \see Environment
48  */
50  public Environment
51  {
52  private:
54 
55  void _need_sets() const;
56 
57  protected:
58  virtual void populate_sets() const = 0;
59 
60  virtual void populate_standard_sets() const;
61  void set_always_exists(const SetName &) const;
62 
63  public:
64  ///\name Basic operations
65  ///\{
66 
68  virtual ~EnvironmentImplementation() = 0;
69 
70  ///\}
71 
72  virtual std::shared_ptr<const FSPathSequence> bashrc_files() const
73  PALUDIS_ATTRIBUTE((warn_unused_result));
74 
75  virtual std::shared_ptr<const FSPathSequence> syncers_dirs() const
76  PALUDIS_ATTRIBUTE((warn_unused_result));
77 
78  virtual std::shared_ptr<const FSPathSequence> fetchers_dirs() const
79  PALUDIS_ATTRIBUTE((warn_unused_result));
80 
81  virtual std::string distribution() const
82  PALUDIS_ATTRIBUTE((warn_unused_result));
83 
84  virtual bool is_paludis_package(const QualifiedPackageName &) const
85  PALUDIS_ATTRIBUTE((warn_unused_result));
86 
87  virtual std::shared_ptr<PackageIDSequence> operator[] (const Selection &) const
88  PALUDIS_ATTRIBUTE((warn_unused_result));
89 
90  virtual NotifierCallbackID add_notifier_callback(const NotifierCallbackFunction &);
91 
92  virtual void remove_notifier_callback(const NotifierCallbackID);
93 
94  virtual void trigger_notifier_callback(const NotifierCallbackEvent &) const;
95 
96  virtual void add_set(
97  const SetName &,
98  const SetName &,
99  const std::function<std::shared_ptr<const SetSpecTree> ()> &,
100  const bool combine) const;
101 
102  virtual std::shared_ptr<const SetNameSet> set_names() const
103  PALUDIS_ATTRIBUTE((warn_unused_result));
104 
105  virtual const std::shared_ptr<const SetSpecTree> set(const SetName &) const
106  PALUDIS_ATTRIBUTE((warn_unused_result));
107 
108  virtual void add_repository(int importance, const std::shared_ptr<Repository> &);
109 
110  virtual const std::shared_ptr<const Repository> fetch_repository(const RepositoryName &) const
111  PALUDIS_ATTRIBUTE((warn_unused_result));
112 
113  virtual const std::shared_ptr<Repository> fetch_repository(const RepositoryName &)
114  PALUDIS_ATTRIBUTE((warn_unused_result));
115 
116  virtual bool has_repository_named(const RepositoryName &) const
117  PALUDIS_ATTRIBUTE((warn_unused_result));
118 
119  virtual QualifiedPackageName fetch_unique_qualified_package_name(
120  const PackageNamePart &, const Filter & = all_filter(), const bool disambiguate = true) const
121  PALUDIS_ATTRIBUTE((warn_unused_result));
122 
123  virtual bool more_important_than(const RepositoryName &, const RepositoryName &) const
124  PALUDIS_ATTRIBUTE((warn_unused_result));
125 
126  virtual RepositoryConstIterator begin_repositories() const
127  PALUDIS_ATTRIBUTE((warn_unused_result));
128 
129  virtual RepositoryConstIterator end_repositories() const
130  PALUDIS_ATTRIBUTE((warn_unused_result));
131 
132  virtual const std::shared_ptr<const Set<std::string> > expand_licence(
133  const std::string &) const;
134  };
135 
137  public Exception
138  {
139  public:
140  DuplicateSetError(const SetName & s) noexcept;
141  };
142 }
143 
144 #endif
Definition: pimp.hh:51
Definition: about_metadata-fwd.hh:23
Definition: name.hh:110
Definition: filter.hh:57
Definition: exception.hh:74
Definition: environment.hh:200
Definition: notifier_callback.hh:33
Definition: environment_implementation.hh:49
Definition: wrapped_forward_iterator-fwd.hh:26
Definition: wrapped_value-fwd.hh:29
Definition: environment_implementation.hh:136
Definition: selection.hh:70
#define PALUDIS_ATTRIBUTE(x)
Definition: attributes.hh:53
#define PALUDIS_VISIBLE
Definition: attributes.hh:59