Path: blob/main/contrib/atf/atf-c++/detail/env.hpp
39562 views
// Copyright (c) 2007 The NetBSD Foundation, Inc.1// All rights reserved.2//3// Redistribution and use in source and binary forms, with or without4// modification, are permitted provided that the following conditions5// are met:6// 1. Redistributions of source code must retain the above copyright7// notice, this list of conditions and the following disclaimer.8// 2. Redistributions in binary form must reproduce the above copyright9// notice, this list of conditions and the following disclaimer in the10// documentation and/or other materials provided with the distribution.11//12// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND13// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,14// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF15// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.16// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY17// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE19// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS20// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER21// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR22// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN23// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.2425#if !defined(ATF_CXX_DETAIL_ENV_HPP)26#define ATF_CXX_DETAIL_ENV_HPP2728#include <string>2930namespace atf {31namespace env {3233// ------------------------------------------------------------------------34// Free functions.35// ------------------------------------------------------------------------3637//!38//! \brief Returns the value of an environment variable.39//!40//! Returns the value of the specified environment variable. The variable41//! must be defined.42//!43std::string get(const std::string&);4445//!46//! \brief Returns the value of an environment variable with a default.47//!48std::string get(const std::string&, const std::string&);4950//!51//! \brief Checks if the environment has a variable.52//!53//! Checks if the environment has a given variable.54//!55bool has(const std::string&);5657//!58//! \brief Sets an environment variable to a given value.59//!60//! Sets the specified environment variable to the given value. Note that61//! variables set to the empty string are different to undefined ones.62//!63//! Be aware that this alters the program's global status, which in general64//! is a bad thing to do due to the side-effects it may have. There are65//! some legitimate usages for this function, though.66//!67void set(const std::string&, const std::string&);6869//!70//! \brief Unsets an environment variable.71//!72//! Unsets the specified environment variable Note that undefined73//! variables are different to those defined but set to an empty value.74//!75//! Be aware that this alters the program's global status, which in general76//! is a bad thing to do due to the side-effects it may have. There are77//! some legitimate usages for this function, though.78//!79void unset(const std::string&);8081} // namespace env82} // namespace atf8384#endif // !defined(ATF_CXX_DETAIL_ENV_HPP)858687