1e2207522Sjmmv // 2e2207522Sjmmv // Automated Testing Framework (atf) 3e2207522Sjmmv // 4*a551a20fSjmmv // Copyright (c) 2007 The NetBSD Foundation, Inc. 5e2207522Sjmmv // All rights reserved. 6e2207522Sjmmv // 7e2207522Sjmmv // Redistribution and use in source and binary forms, with or without 8e2207522Sjmmv // modification, are permitted provided that the following conditions 9e2207522Sjmmv // are met: 10e2207522Sjmmv // 1. Redistributions of source code must retain the above copyright 11e2207522Sjmmv // notice, this list of conditions and the following disclaimer. 12e2207522Sjmmv // 2. Redistributions in binary form must reproduce the above copyright 13e2207522Sjmmv // notice, this list of conditions and the following disclaimer in the 14e2207522Sjmmv // documentation and/or other materials provided with the distribution. 15e2207522Sjmmv // 16e2207522Sjmmv // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND 17e2207522Sjmmv // CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 18e2207522Sjmmv // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19e2207522Sjmmv // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20e2207522Sjmmv // IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 21e2207522Sjmmv // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22e2207522Sjmmv // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23e2207522Sjmmv // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24e2207522Sjmmv // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25e2207522Sjmmv // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26e2207522Sjmmv // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27e2207522Sjmmv // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28e2207522Sjmmv // 29e2207522Sjmmv 30e2207522Sjmmv #if !defined(_ATF_CXX_CONFIG_HPP_) 31e2207522Sjmmv #define _ATF_CXX_CONFIG_HPP_ 32e2207522Sjmmv 33e2207522Sjmmv #include <map> 34e2207522Sjmmv #include <string> 35e2207522Sjmmv 36e2207522Sjmmv namespace atf { 37e2207522Sjmmv 38e2207522Sjmmv namespace config { 39e2207522Sjmmv 40e2207522Sjmmv //! 41e2207522Sjmmv //! \brief Gets a build-time configuration variable's value. 42e2207522Sjmmv //! 43e2207522Sjmmv //! Given the name of a build-time configuration variable, returns its 44e2207522Sjmmv //! textual value. The user is free to override these by setting their 45e2207522Sjmmv //! corresponding environment variables. Therefore always use this 46e2207522Sjmmv //! interface to get the value of these variables. 47e2207522Sjmmv //! 48e2207522Sjmmv //! \pre The variable must exist. 49e2207522Sjmmv //! 50e2207522Sjmmv const std::string& get(const std::string&); 51e2207522Sjmmv 52e2207522Sjmmv //! 53e2207522Sjmmv //! \brief Returns all the build-time configuration variables. 54e2207522Sjmmv //! 55e2207522Sjmmv //! Returns a name to value map containing all build-time configuration 56e2207522Sjmmv //! variables. 57e2207522Sjmmv //! 58e2207522Sjmmv const std::map< std::string, std::string >& get_all(void); 59e2207522Sjmmv 60e2207522Sjmmv //! 61e2207522Sjmmv //! \brief Checks whether a build-time configuration variable exists. 62e2207522Sjmmv //! 63e2207522Sjmmv //! Given the name of a build-time configuration variable, checks 64e2207522Sjmmv //! whether it is defined and returns a boolean indicating this 65e2207522Sjmmv //! condition. The program only has to use this function to sanity-check 66e2207522Sjmmv //! a variable name provided by the user. Otherwise it can assume that 67e2207522Sjmmv //! the variables are defined. 68e2207522Sjmmv //! 69e2207522Sjmmv bool has(const std::string&); 70e2207522Sjmmv 71e2207522Sjmmv } // namespace config 72e2207522Sjmmv 73e2207522Sjmmv } // namespace atf 74e2207522Sjmmv 75e2207522Sjmmv #endif // !defined(_ATF_CXX_CONFIG_HPP_) 76