ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
environment.cpp
1// #################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2024 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6// #################################################################################################
8
9#if !DOXYGEN
12# if defined (__GLIBCXX__) || defined(__APPLE__) || defined(__ANDROID_NDK__)
13# include <unistd.h>
14# elif defined( _WIN32 )
15# include <direct.h>
16# else
17# pragma message ("Unknown Platform in file: " __FILE__ )
18# endif
19#endif // !DOXYGEN
20
21namespace alib { namespace lang::system {
22
23
25 AString& target,
26 lang::CurrentData targetData )
27{
28 if ( targetData == lang::CurrentData::Clear )
29 target.Reset();
30
31 if ( name.IsEmpty() )
32 return false;
33
34 ALIB_STRINGS_TO_NARROW( name, nName, 512 )
36 nchar* env= std::getenv( nName );
38
39 if( env != nullptr )
40 {
41 target._( NString( env ) );
42 return true;
43 }
44 return false;
45}
46
47}} // namespace [alib::lang::system]
TAString & _(const TString< TChar > &src, integer regionStart, integer regionLength=MAX_LEN)
constexpr bool IsEmpty() const
Definition string.hpp:383
#define ALIB_WARNINGS_RESTORE
Definition alib.hpp:849
#define ALIB_STRINGS_TO_NARROW( src, dest, bufSize)
#define ALIB_WARNINGS_ALLOW_UNSAFE_FUNCTION_OR_VARIABLE
Definition alib.hpp:772
@ Clear
Chooses to clear existing data.
Definition alib.cpp:69
strings::TString< nchar > NString
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
static ALIB_API bool Get(const CString &varName, AString &target, lang::CurrentData targetData=lang::CurrentData::Clear)