ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
environment.hpp
Go to the documentation of this file.
1/** ************************************************************************************************
2 * \file
3 * This header file is part of sub-namespace # alib::lang::system of module \alib_basecamp of
4 * the \aliblong.
5 *
6 * \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
7 * Published under \ref mainpage_license "Boost Software License".
8 **************************************************************************************************/
9#ifndef HPP_ALIB_CAMP_ENVIRONMENT
10#define HPP_ALIB_CAMP_ENVIRONMENT 1
11
12#if !defined (HPP_ALIB_STRINGS_ASTRING)
14#endif
15
17
18#if !defined (HPP_ALIB_STRINGS_CSTRING)
20#endif
21
22namespace alib { namespace lang::system {
23
24/** ************************************************************************************************
25 * Simple struct providing one static method that reads an environment variable into an
26 * \alib string type.
27 *
28 * While under posix compatible operating systems, environment variable names are
29 * case sensitive, under Microsoft windows they are not.
30 **************************************************************************************************/
32{
33 /** ************************************************************************************************
34 * Reads an environment variable into an \alib string.
35 *
36 * \attention
37 * 1. While under posix compatible operating systems, environment variable names are
38 * case sensitive, under Microsoft windows they are not.
39 * \attention
40 * 2. As documented with
41 * \https{std::getenv,en.cppreference.com/w/cpp/utility/program/getenv}, the operation is
42 * not thread safe against changes of the environment in parallel threads.
43 *
44 * @param varName The name of the variable to be retrieved.
45 * @param target An AString to write the result to.
46 * @param targetData If \c CurrentData::Keep, the parameter \p{target} is not cleared
47 * before the result is written. Defaults to \c CurrentData::Clear.
48 * @return \c true if variable was found.
49 **************************************************************************************************/
50 ALIB_API static
51 bool Get( const CString& varName,
52 AString& target,
54};
55
56} // namespace alib[:: lang::system]
57
58/// Type alias in namespace \b alib.
60
61} // namespace [alib]
62
63#endif // HPP_ALIB_CAMP_ENVIRONMENT
#define ALIB_ASSERT_MODULE(modulename)
Definition alib.hpp:190
#define ALIB_API
Definition alib.hpp:538
@ Clear
Chooses to clear existing data.
@ Get
Denotes to search data.
Definition alib.cpp:57