paludis  Version 2.6.0
literal_metadata_key.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_LITERAL_METADATA_KEY_HH
21 #define PALUDIS_GUARD_PALUDIS_LITERAL_METADATA_KEY_HH 1
22 
23 #include <paludis/metadata_key.hh>
24 #include <paludis/util/pimp.hh>
25 #include <paludis/util/sequence.hh>
26 #include <paludis/util/set.hh>
27 
28 /** \file
29  * Declarations for literal metadata key classes.
30  *
31  * \ingroup g_literal_metadata_key
32  *
33  * \section Examples
34  *
35  * - \ref example_metadata_key.cc "example_metadata_key.cc" (for metadata keys)
36  */
37 
38 
39 namespace paludis
40 {
41  template <typename T_>
43  public MetadataValueKey<T_>
44  {
45  public:
46  virtual const std::string pretty_print_value(
47  const PrettyPrinter &,
48  const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
49  };
50 
51  /**
52  * A LiteralMetadataValueKey is a MetadataValueKey whose value is a
53  * copyable literal that is known at construction time.
54  *
55  * \ingroup g_literal_metadata_key
56  * \since 0.26
57  */
58  template <typename T_>
60  public std::conditional<MetadataValueKeyIsPrettyPrintable<T_>::value, PrettyPrintableLiteralMetadataValueKey<T_>, MetadataValueKey<T_> >::type
61  {
62  private:
64 
65  public:
66  ///\name Basic operations
67  ///\{
68 
69  LiteralMetadataValueKey(const std::string &, const std::string &, const MetadataKeyType,
70  const T_ &);
72 
73  ///\}
74 
75  virtual const T_ parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
76 
77  virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
78  virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
79  virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
80 
81  /**
82  * \since 0.36
83  */
84  void change_value(const T_ &);
85  };
86 
87  /**
88  * A LiteralMetadataFSPathSequenceKey is a MetadataCollectionKey<FSPathSequence>
89  * whose value is known at construction time.
90  *
91  * \ingroup g_literal_metadata_key
92  * \since 0.26
93  */
95  public MetadataCollectionKey<FSPathSequence>
96  {
97  private:
99 
100  public:
101  ///\name Basic operations
102  ///\{
103 
104  LiteralMetadataFSPathSequenceKey(const std::string &, const std::string &, const MetadataKeyType,
105  const std::shared_ptr<const FSPathSequence> &);
107 
108  ///\}
109 
110  virtual const std::shared_ptr<const FSPathSequence> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
111 
112  virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
113  virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
114  virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
115 
116  virtual const std::string pretty_print_value(
117  const PrettyPrinter &,
118  const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
119  };
120 
121  /**
122  * A LiteralMetadataStringSetKey is a MetadataCollectionKey<Set<std::string> >
123  * whose value is known at construction time.
124  *
125  * \ingroup g_literal_metadata_key
126  * \since 0.26
127  */
129  public MetadataCollectionKey<Set<std::string> >
130  {
131  private:
133 
134  public:
135  ///\name Basic operations
136  ///\{
137 
138  LiteralMetadataStringSetKey(const std::string &, const std::string &, const MetadataKeyType,
139  const std::shared_ptr<const Set<std::string> > &);
141 
142  ///\}
143 
144  virtual const std::shared_ptr<const Set<std::string> > parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
145 
146  virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
147  virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
148  virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
149 
150  virtual const std::string pretty_print_value(
151  const PrettyPrinter &,
152  const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
153  };
154 
155  /**
156  * A LiteralMetadataStringSequenceKey is a MetadataCollectionKey<Sequence<std::string> >
157  * whose value is known at construction time.
158  *
159  * \ingroup g_literal_metadata_key
160  * \since 0.30
161  */
163  public MetadataCollectionKey<Sequence<std::string> >
164  {
165  private:
167 
168  public:
169  ///\name Basic operations
170  ///\{
171 
172  LiteralMetadataStringSequenceKey(const std::string &, const std::string &, const MetadataKeyType,
173  const std::shared_ptr<const Sequence<std::string> > &);
175 
176  ///\}
177 
178  virtual const std::shared_ptr<const Sequence<std::string> > parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
179 
180  virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
181  virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
182  virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
183 
184  virtual const std::string pretty_print_value(
185  const PrettyPrinter &,
186  const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
187  };
188 
189  /**
190  * A LiteralMetadataTimeKey is a MetadataTimeKey whose value is known at
191  * construction time.
192  *
193  * \ingroup g_literal_metadata_key
194  * \since 0.36
195  * \since 0.44 Timestamp instead of time_t
196  */
198  public MetadataTimeKey
199  {
200  private:
202 
203  public:
204  ///\name Basic operations
205  ///\{
206 
207  LiteralMetadataTimeKey(const std::string &, const std::string &, const MetadataKeyType, const Timestamp);
209 
210  ///\}
211 
212  virtual Timestamp parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
213 
214  virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
215  virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
216  virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
217  };
218 
219  /**
220  * A LiteralMetadataStringStringMapKey is a MetadataCollectionKey<Set<std::string> >
221  * whose value is known at construction time.
222  *
223  * \ingroup g_literal_metadata_key
224  * \since 0.55
225  */
227  public MetadataCollectionKey<Map<std::string, std::string> >
228  {
229  private:
231 
232  public:
233  ///\name Basic operations
234  ///\{
235 
236  LiteralMetadataStringStringMapKey(const std::string &, const std::string &, const MetadataKeyType,
237  const std::shared_ptr<const Map<std::string, std::string> > &);
239 
240  ///\}
241 
242  virtual const std::shared_ptr<const Map<std::string, std::string> > parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
243 
244  virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
245  virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
246  virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
247 
248  virtual const std::string pretty_print_value(
249  const PrettyPrinter &,
250  const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
251  };
252 
253  /**
254  * A LiteralMetadataMaintainersKey is a MetadataCollectionKey<Maintainers>
255  * whose value is known at construction time.
256  *
257  * \ingroup g_literal_metadata_key
258  * \since 0.68
259  */
261  public MetadataCollectionKey<Maintainers>
262  {
263  private:
265 
266  public:
267  ///\name Basic operations
268  ///\{
269 
270  LiteralMetadataMaintainersKey(const std::string &, const std::string &, const MetadataKeyType,
271  const std::shared_ptr<const Maintainers> &);
273 
274  ///\}
275 
276  virtual const std::shared_ptr<const Maintainers> parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
277 
278  virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
279  virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
280  virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
281 
282  virtual const std::string pretty_print_value(
283  const PrettyPrinter &,
284  const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
285  };
286 }
287 
288 #endif
Definition: pimp.hh:51
Definition: about_metadata-fwd.hh:23
Definition: literal_metadata_key.hh:128
Definition: metadata_key.hh:250
Definition: literal_metadata_key.hh:226
MetadataKeyType
Definition: metadata_key-fwd.hh:16
Definition: literal_metadata_key.hh:59
Definition: pretty_printer.hh:35
Definition: metadata_key-fwd.hh:41
Definition: literal_metadata_key.hh:94
Definition: sequence-fwd.hh:32
Definition: literal_metadata_key.hh:162
Definition: literal_metadata_key.hh:260
Definition: set-fwd.hh:35
Definition: timestamp.hh:40
Definition: map-fwd.hh:35
Definition: metadata_key-fwd.hh:39
Definition: literal_metadata_key.hh:197
Definition: options-fwd.hh:34
Definition: literal_metadata_key.hh:42
#define PALUDIS_ATTRIBUTE(x)
Definition: attributes.hh:53
#define PALUDIS_VISIBLE
Definition: attributes.hh:59