1240116Smarcel//
2240116Smarcel// Automated Testing Framework (atf)
3240116Smarcel//
4240116Smarcel// Copyright (c) 2007 The NetBSD Foundation, Inc.
5240116Smarcel// All rights reserved.
6240116Smarcel//
7240116Smarcel// Redistribution and use in source and binary forms, with or without
8240116Smarcel// modification, are permitted provided that the following conditions
9240116Smarcel// are met:
10240116Smarcel// 1. Redistributions of source code must retain the above copyright
11240116Smarcel//    notice, this list of conditions and the following disclaimer.
12240116Smarcel// 2. Redistributions in binary form must reproduce the above copyright
13240116Smarcel//    notice, this list of conditions and the following disclaimer in the
14240116Smarcel//    documentation and/or other materials provided with the distribution.
15240116Smarcel//
16240116Smarcel// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17240116Smarcel// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18240116Smarcel// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19240116Smarcel// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20240116Smarcel// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21240116Smarcel// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22240116Smarcel// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23240116Smarcel// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24240116Smarcel// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25240116Smarcel// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26240116Smarcel// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27240116Smarcel// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28240116Smarcel//
29240116Smarcel
30240116Smarcel#if !defined(_ATF_CXX_ENV_HPP_)
31240116Smarcel#define _ATF_CXX_ENV_HPP_
32240116Smarcel
33240116Smarcel#include <string>
34240116Smarcel
35240116Smarcelnamespace atf {
36240116Smarcelnamespace env {
37240116Smarcel
38240116Smarcel// ------------------------------------------------------------------------
39240116Smarcel// Free functions.
40240116Smarcel// ------------------------------------------------------------------------
41240116Smarcel
42240116Smarcel//!
43240116Smarcel//! \brief Returns the value of an environment variable.
44240116Smarcel//!
45240116Smarcel//! Returns the value of the specified environment variable.  The variable
46240116Smarcel//! must be defined.
47240116Smarcel//!
48240116Smarcelstd::string get(const std::string&);
49240116Smarcel
50240116Smarcel//!
51240116Smarcel//! \brief Checks if the environment has a variable.
52240116Smarcel//!
53240116Smarcel//! Checks if the environment has a given variable.
54240116Smarcel//!
55240116Smarcelbool has(const std::string&);
56240116Smarcel
57240116Smarcel//!
58240116Smarcel//! \brief Sets an environment variable to a given value.
59240116Smarcel//!
60240116Smarcel//! Sets the specified environment variable to the given value.  Note that
61240116Smarcel//! variables set to the empty string are different to undefined ones.
62240116Smarcel//!
63240116Smarcel//! Be aware that this alters the program's global status, which in general
64240116Smarcel//! is a bad thing to do due to the side-effects it may have.  There are
65240116Smarcel//! some legitimate usages for this function, though.
66240116Smarcel//!
67240116Smarcelvoid set(const std::string&, const std::string&);
68240116Smarcel
69240116Smarcel//!
70240116Smarcel//! \brief Unsets an environment variable.
71240116Smarcel//!
72240116Smarcel//! Unsets the specified environment variable  Note that undefined
73240116Smarcel//! variables are different to those defined but set to an empty value.
74240116Smarcel//!
75240116Smarcel//! Be aware that this alters the program's global status, which in general
76240116Smarcel//! is a bad thing to do due to the side-effects it may have.  There are
77240116Smarcel//! some legitimate usages for this function, though.
78240116Smarcel//!
79240116Smarcelvoid unset(const std::string&);
80240116Smarcel
81240116Smarcel} // namespace env
82240116Smarcel} // namespace atf
83240116Smarcel
84240116Smarcel#endif // !defined(_ATF_CXX_ENV_HPP_)
85