Android-cuttlefish cvd tool
env.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <optional>
20#include <string>
21
22namespace adb {
23namespace sysdeps {
24
25// Attempts to retrieve the environment variable value for |var|. Returns std::nullopt
26// if unset.
27std::optional<std::string> GetEnvironmentVariableUTF8(std::string_view var);
28
29// Gets the host name of the system. Returns empty string on failure.
30std::string GetHostNameUTF8();
31// Gets the current login user. Returns empty string on failure.
32std::string GetLoginNameUTF8();
33
34} // namespace sysdeps
35} // namespace adb
std::string GetHostNameUTF8()
Definition: env.cpp:73
std::string GetLoginNameUTF8()
Definition: env.cpp:98
std::optional< std::string > GetEnvironmentVariableUTF8(std::string_view var)
Definition: key.h:25