1895f502bSjmmv // 2895f502bSjmmv // Automated Testing Framework (atf) 3895f502bSjmmv // 4*a551a20fSjmmv // Copyright (c) 2007 The NetBSD Foundation, Inc. 5895f502bSjmmv // All rights reserved. 6895f502bSjmmv // 7895f502bSjmmv // Redistribution and use in source and binary forms, with or without 8895f502bSjmmv // modification, are permitted provided that the following conditions 9895f502bSjmmv // are met: 10895f502bSjmmv // 1. Redistributions of source code must retain the above copyright 11895f502bSjmmv // notice, this list of conditions and the following disclaimer. 12895f502bSjmmv // 2. Redistributions in binary form must reproduce the above copyright 13895f502bSjmmv // notice, this list of conditions and the following disclaimer in the 14895f502bSjmmv // documentation and/or other materials provided with the distribution. 15895f502bSjmmv // 16895f502bSjmmv // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND 17895f502bSjmmv // CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 18895f502bSjmmv // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19895f502bSjmmv // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20895f502bSjmmv // IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 21895f502bSjmmv // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22895f502bSjmmv // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23895f502bSjmmv // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24895f502bSjmmv // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25895f502bSjmmv // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26895f502bSjmmv // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27895f502bSjmmv // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28895f502bSjmmv // 29895f502bSjmmv 30895f502bSjmmv #if !defined(_ATF_CXX_ENV_HPP_) 31895f502bSjmmv #define _ATF_CXX_ENV_HPP_ 32895f502bSjmmv 33895f502bSjmmv #include <string> 34895f502bSjmmv 35895f502bSjmmv namespace atf { 36895f502bSjmmv namespace env { 37895f502bSjmmv 38895f502bSjmmv // ------------------------------------------------------------------------ 39895f502bSjmmv // Free functions. 40895f502bSjmmv // ------------------------------------------------------------------------ 41895f502bSjmmv 42895f502bSjmmv //! 43895f502bSjmmv //! \brief Returns the value of an environment variable. 44895f502bSjmmv //! 45895f502bSjmmv //! Returns the value of the specified environment variable. The variable 46895f502bSjmmv //! must be defined. 47895f502bSjmmv //! 48895f502bSjmmv std::string get(const std::string&); 49895f502bSjmmv 50895f502bSjmmv //! 51895f502bSjmmv //! \brief Checks if the environment has a variable. 52895f502bSjmmv //! 53895f502bSjmmv //! Checks if the environment has a given variable. 54895f502bSjmmv //! 55895f502bSjmmv bool has(const std::string&); 56895f502bSjmmv 57895f502bSjmmv //! 58895f502bSjmmv //! \brief Sets an environment variable to a given value. 59895f502bSjmmv //! 60895f502bSjmmv //! Sets the specified environment variable to the given value. Note that 61895f502bSjmmv //! variables set to the empty string are different to undefined ones. 62895f502bSjmmv //! 63895f502bSjmmv //! Be aware that this alters the program's global status, which in general 64895f502bSjmmv //! is a bad thing to do due to the side-effects it may have. There are 65895f502bSjmmv //! some legitimate usages for this function, though. 66895f502bSjmmv //! 67895f502bSjmmv void set(const std::string&, const std::string&); 68895f502bSjmmv 69895f502bSjmmv //! 70895f502bSjmmv //! \brief Unsets an environment variable. 71895f502bSjmmv //! 72895f502bSjmmv //! Unsets the specified environment variable Note that undefined 73895f502bSjmmv //! variables are different to those defined but set to an empty value. 74895f502bSjmmv //! 75895f502bSjmmv //! Be aware that this alters the program's global status, which in general 76895f502bSjmmv //! is a bad thing to do due to the side-effects it may have. There are 77895f502bSjmmv //! some legitimate usages for this function, though. 78895f502bSjmmv //! 79895f502bSjmmv void unset(const std::string&); 80895f502bSjmmv 81895f502bSjmmv } // namespace env 82895f502bSjmmv } // namespace atf 83895f502bSjmmv 84895f502bSjmmv #endif // !defined(_ATF_CXX_ENV_HPP_) 85