ALib C++ Library
Library Version: 2402 R1
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 !defined(ALIB_DOX)
10#if !defined (HPP_ALIB_CAMP_ENVIRONMENT)
12#endif
13
14#if !defined (HPP_ALIB_STRINGS_LOCALSTRING)
16#endif
17
18#if defined (__GLIBCXX__) || defined(__APPLE__) || defined(__ANDROID_NDK__)
19 #include <unistd.h>
20#elif defined( _WIN32 )
21 #include <direct.h>
22#else
23 #pragma message ("Unknown Platform in file: " __FILE__ )
24#endif
25#endif // !defined(ALIB_DOX)
26
27namespace alib { namespace lang::system {
28
29
31 AString& target,
32 lang::CurrentData targetData )
33{
34 if ( targetData == lang::CurrentData::Clear )
35 target.Reset();
36
37 if ( name.IsEmpty() )
38 return false;
39
40 ALIB_STRINGS_TO_NARROW( name, nName, 512 )
42 nchar* env= std::getenv( nName );
44
45 if( env != nullptr )
46 {
47 target._( NString( env ) );
48 return true;
49 }
50 return false;
51}
52
53}} // namespace [alib::lang::system]
TAString & _(const TString< TChar > &src, integer regionStart, integer regionLength=MAX_LEN)
Definition astring.hpp:1056
constexpr bool IsEmpty() const
Definition string.hpp:414
#define ALIB_WARNINGS_RESTORE
Definition alib.hpp:715
#define ALIB_STRINGS_TO_NARROW( src, dest, bufSize)
#define ALIB_WARNINGS_ALLOW_UNSAFE_FUNCTION_OR_VARIABLE
Definition alib.hpp:656
@ Clear
Chooses to clear existing data.
Definition alib.cpp:57
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)