/* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General * Public License version 2, as published by the Free Software Foundation. * * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef PALUDIS_GUARD_PALUDIS_PALUDISLIKE_OPTIONS_CONF_HH #define PALUDIS_GUARD_PALUDIS_PALUDISLIKE_OPTIONS_CONF_HH 1 #include #include #include #include #include #include #include #include #include #include #include #include #include namespace paludis { namespace n { typedef Name allow_locking; typedef Name environment; typedef Name make_config_file; } /** * Turn an FSPath into a config file for PaludisLikeOptionsConf. * * This might need to deal with weird things like bash config files, so we * leave it up to the caller to specify how it works. * * \since 0.44 */ typedef std::function< const std::shared_ptr ( const FSPath &, const LineConfigFileOptions &) > PaludisLikeOptionsConfMakeConfigFileFunction; /** * Options for PaludisLikeOptionsConf. * * \since 0.44 */ struct PaludisLikeOptionsConfParams { NamedValue allow_locking; NamedValue environment; NamedValue make_config_file; }; /** * Common helper class for a Paludis-format use.conf or options.conf. * * The format is shared closely between PaludisEnvironment and the Exheres * profile format for E repositories. * * \since 0.44 */ class PALUDIS_VISIBLE PaludisLikeOptionsConf { private: Pimp _imp; public: PaludisLikeOptionsConf(const PaludisLikeOptionsConfParams &); ~PaludisLikeOptionsConf(); void add_file(const FSPath &); const std::pair want_choice_enabled_locked( const std::shared_ptr &, const ChoicePrefixName &, const UnprefixedChoiceName & ) const PALUDIS_ATTRIBUTE((warn_unused_result)); const std::string value_for_choice_parameter( const std::shared_ptr &, const ChoicePrefixName &, const UnprefixedChoiceName & ) const PALUDIS_ATTRIBUTE((warn_unused_result)); const std::shared_ptr > known_choice_value_names( const std::shared_ptr &, const ChoicePrefixName & ) const PALUDIS_ATTRIBUTE((warn_unused_result)); }; extern template class Pimp; } #endif