paludis  Version 2.6.0
mask.hh
Go to the documentation of this file.
1 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
2 
3 /*
4  * Copyright (c) 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_MASK_HH
21 #define PALUDIS_GUARD_PALUDIS_MASK_HH 1
22 
23 #include <paludis/mask-fwd.hh>
25 #include <paludis/dep_spec-fwd.hh>
26 #include <paludis/util/visitor.hh>
28 #include <paludis/util/fs_path.hh>
30 #include <paludis/util/named_value.hh>
31 #include <paludis/util/type_list.hh>
32 #include <string>
33 
34 /** \file
35  * Declarations for mask classes.
36  *
37  * \ingroup g_mask
38  *
39  * \section Examples
40  *
41  * - \ref example_mask.cc "example_mask.cc" (for masks)
42  */
43 
44 namespace paludis
45 {
46  namespace n
47  {
48  typedef Name<struct name_comment> comment;
49  typedef Name<struct name_mask> mask;
50  typedef Name<struct name_mask_file> mask_file;
51  typedef Name<struct name_override_reason> override_reason;
52  typedef Name<struct name_token> token;
53  }
54 
55  /**
56  * A Mask represents one reason why a PackageID is masked (not available to
57  * be installed).
58  *
59  * A basic Mask has:
60  *
61  * - A single character key, which can be used by clients if they need a
62  * very compact way of representing a mask.
63  *
64  * - A description.
65  *
66  * Subclasses provide additional information.
67  *
68  * \ingroup g_mask
69  * \since 0.26
70  * \nosubgrouping
71  */
73  public virtual DeclareAbstractAcceptMethods<Mask, MakeTypeList<
74  UserMask, UnacceptedMask, RepositoryMask, UnsupportedMask>::Type>
75  {
76  public:
77  ///\name Basic operations
78  ///\{
79 
80  virtual ~Mask() = 0;
81 
82  ///\}
83 
84  /**
85  * A single character key, which can be used by clients if they need
86  * a very compact way of representing a mask.
87  */
88  virtual char key() const = 0;
89 
90  /**
91  * A description of the mask.
92  */
93  virtual const std::string description() const = 0;
94  };
95 
96  /**
97  * A UserMask is a Mask due to user configuration.
98  *
99  * \ingroup g_mask
100  * \since 0.26
101  * \nosubgrouping
102  */
104  public Mask,
105  public ImplementAcceptMethods<Mask, UserMask>
106  {
107  public:
108  /**
109  * An associated token, for Environment::unmasked_by_user. Might be empty,
110  * but is probably "user".
111  *
112  * \since 0.60
113  */
114  virtual const std::string token() const;
115  };
116 
117  /**
118  * An UnacceptedMask is a Mask that signifies that a particular value or
119  * combination of values in (for example) a MetadataCollectionKey or
120  * MetadataSpecTreeKey is not accepted by user configuration.
121  *
122  * \ingroup g_mask
123  * \since 0.26
124  * \nosubgrouping
125  */
127  public Mask,
128  public ImplementAcceptMethods<Mask, UnacceptedMask>
129  {
130  public:
131  /**
132  * Fetch the raw name of the metadata key that is not accepted.
133  *
134  * \since 0.59
135  */
136  virtual const std::string unaccepted_key_name() const = 0;
137  };
138 
139  /**
140  * A RepositoryMask is a Mask that signifies that a PackageID has been
141  * marked as masked by a Repository.
142  *
143  * \ingroup g_mask
144  * \since 0.26
145  * \nosubgrouping
146  */
148  public Mask,
149  public ImplementAcceptMethods<Mask, RepositoryMask>
150  {
151  public:
152  /**
153  * An associated comment. Might be empty.
154  *
155  * \since 0.59
156  */
157  virtual const std::string comment() const = 0;
158 
159  /**
160  * An associated token, for Environment::unmasked_by_user. Might be empty.
161  *
162  * \since 0.59
163  */
164  virtual const std::string token() const = 0;
165 
166  /**
167  * The file whence the mask originates.
168  *
169  * \since 0.59
170  */
171  virtual const FSPath mask_file() const = 0;
172 
173  };
174 
175  /**
176  * An UnsupportedMask is a Mask that signifies that a PackageID is not
177  * supported, for example because it is broken or because it uses an
178  * unrecognised EAPI.
179  *
180  * \ingroup g_mask
181  * \since 0.26
182  * \nosubgrouping
183  */
185  public Mask,
186  public ImplementAcceptMethods<Mask, UnsupportedMask>
187  {
188  public:
189  /**
190  * An explanation of why we are unsupported.
191  */
192  virtual const std::string explanation() const = 0;
193  };
194 
195  /**
196  * An OverriddenMask holds a Mask and an explanation of why it has been overridden.
197  *
198  * \ingroup g_mask
199  * \since 0.34
200  */
202  {
205 
206  };
207 }
208 
209 #endif
Definition: about_metadata-fwd.hh:23
Definition: mask.hh:147
Definition: visitor-fwd.hh:52
Definition: mask.hh:184
Definition: mask.hh:126
Definition: mask.hh:201
Definition: named_value-fwd.hh:26
Definition: mask.hh:72
Definition: mask.hh:103
Definition: visitor-fwd.hh:49
Definition: fs_path.hh:33
#define PALUDIS_VISIBLE
Definition: attributes.hh:59