paludis  Version 2.0.0
paludislike_options_conf.hh
1 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
2 
3 /*
4  * Copyright (c) 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_PALUDISLIKE_OPTIONS_CONF_HH
21 #define PALUDIS_GUARD_PALUDIS_PALUDISLIKE_OPTIONS_CONF_HH 1
22 
23 #include <paludis/paludislike_options_conf-fwd.hh>
25 #include <paludis/util/pimp.hh>
26 #include <paludis/util/named_value.hh>
27 #include <paludis/util/tribool-fwd.hh>
28 #include <paludis/util/set-fwd.hh>
29 #include <paludis/util/fs_path-fwd.hh>
30 #include <paludis/util/config_file-fwd.hh>
31 #include <paludis/choice-fwd.hh>
34 #include <memory>
35 #include <functional>
36 
37 namespace paludis
38 {
39  namespace n
40  {
41  typedef Name<struct name_allow_locking> allow_locking;
42  typedef Name<struct name_environment> environment;
43  typedef Name<struct name_make_config_file> make_config_file;
44  }
45 
46  /**
47  * Turn an FSPath into a config file for PaludisLikeOptionsConf.
48  *
49  * This might need to deal with weird things like bash config files, so we
50  * leave it up to the caller to specify how it works.
51  *
52  * \since 0.44
53  */
54  typedef std::function<
55  const std::shared_ptr<const LineConfigFile> (
56  const FSPath &,
57  const LineConfigFileOptions &)
59 
60  /**
61  * Options for PaludisLikeOptionsConf.
62  *
63  * \since 0.44
64  */
66  {
70  };
71 
72  /**
73  * Common helper class for a Paludis-format use.conf or options.conf.
74  *
75  * The format is shared closely between PaludisEnvironment and the Exheres
76  * profile format for E repositories.
77  *
78  * \since 0.44
79  */
81  {
82  private:
84 
85  public:
88 
89  void add_file(const FSPath &);
90 
91  const std::pair<Tribool, bool> want_choice_enabled_locked(
92  const std::shared_ptr<const PackageID> &,
93  const ChoicePrefixName &,
94  const UnprefixedChoiceName &
95  ) const
96  PALUDIS_ATTRIBUTE((warn_unused_result));
97 
98  const std::string value_for_choice_parameter(
99  const std::shared_ptr<const PackageID> &,
100  const ChoicePrefixName &,
101  const UnprefixedChoiceName &
102  ) const
103  PALUDIS_ATTRIBUTE((warn_unused_result));
104 
105  const std::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
106  const std::shared_ptr<const PackageID> &,
107  const ChoicePrefixName &
108  ) const
109  PALUDIS_ATTRIBUTE((warn_unused_result));
110  };
111 
112  extern template class Pimp<PaludisLikeOptionsConf>;
113 
114 }
115 
116 #endif
Definition: pimp.hh:51
std::function< const std::shared_ptr< const LineConfigFile > const FSPath &, const LineConfigFileOptions &) > PaludisLikeOptionsConfMakeConfigFileFunction
Definition: paludislike_options_conf.hh:58
Options< LineConfigFileOption > LineConfigFileOptions
Definition: config_file-fwd.hh:32
Definition: paludislike_options_conf.hh:80
Definition: wrapped_value-fwd.hh:29
Definition: paludislike_options_conf.hh:65
Definition: fs_path.hh:33
#define PALUDIS_ATTRIBUTE(x)
Definition: attributes.hh:64
#define PALUDIS_VISIBLE
Definition: attributes.hh:71