]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/winapi/include/boost/detail/winapi/environment.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / winapi / include / boost / detail / winapi / environment.hpp
CommitLineData
7c673cae
FG
1// environment.hpp --------------------------------------------------------------//
2
3// Copyright 2016 Klemens D. Morgenstern
4
5// Distributed under the Boost Software License, Version 1.0.
6// See http://www.boost.org/LICENSE_1_0.txt
7
8#ifndef BOOST_DETAIL_WINAPI_ENVIRONMENT_HPP_
9#define BOOST_DETAIL_WINAPI_ENVIRONMENT_HPP_
10
11#include <boost/detail/winapi/basic_types.hpp>
12
13#ifdef BOOST_HAS_PRAGMA_ONCE
14#pragma once
15#endif
16
17#if !defined( BOOST_USE_WINDOWS_H )
18extern "C" {
19#if !defined( BOOST_NO_ANSI_APIS )
20BOOST_SYMBOL_IMPORT boost::detail::winapi::LPSTR_ WINAPI GetEnvironmentStringsA();
21BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI FreeEnvironmentStringsA(boost::detail::winapi::LPSTR_);
22
23BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI GetEnvironmentVariableA(
24 boost::detail::winapi::LPCSTR_ lpName,
25 boost::detail::winapi::LPSTR_ lpBuffer,
26 boost::detail::winapi::DWORD_ nSize
27);
28
29BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI SetEnvironmentVariableA(
30 boost::detail::winapi::LPCSTR_ lpName,
31 boost::detail::winapi::LPCSTR_ lpValue
32);
33#endif // !defined( BOOST_NO_ANSI_APIS )
34
35BOOST_SYMBOL_IMPORT boost::detail::winapi::LPWSTR_ WINAPI GetEnvironmentStringsW();
36BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI FreeEnvironmentStringsW(boost::detail::winapi::LPWSTR_);
37
38BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI GetEnvironmentVariableW(
39 boost::detail::winapi::LPCWSTR_ lpName,
40 boost::detail::winapi::LPWSTR_ lpBuffer,
41 boost::detail::winapi::DWORD_ nSize
42);
43
44BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI SetEnvironmentVariableW(
45 boost::detail::winapi::LPCWSTR_ lpName,
46 boost::detail::winapi::LPCWSTR_ lpValue
47);
48} // extern "C"
49#endif // !defined( BOOST_USE_WINDOWS_H )
50
51namespace boost { namespace detail { namespace winapi {
52
53#if !defined( BOOST_NO_ANSI_APIS )
54using ::GetEnvironmentStringsA;
55using ::FreeEnvironmentStringsA;
56using ::GetEnvironmentVariableA;
57using ::SetEnvironmentVariableA;
58#endif // !defined( BOOST_NO_ANSI_APIS )
59
60using ::GetEnvironmentStringsW;
61using ::FreeEnvironmentStringsW;
62using ::GetEnvironmentVariableW;
63using ::SetEnvironmentVariableW;
64
65template< typename Char >
66Char* get_environment_strings();
67
68#if !defined( BOOST_NO_ANSI_APIS )
69
70template< >
71BOOST_FORCEINLINE char* get_environment_strings< char >()
72{
73 return GetEnvironmentStringsA();
74}
75
76BOOST_FORCEINLINE BOOL_ free_environment_strings(boost::detail::winapi::LPSTR_ p)
77{
78 return FreeEnvironmentStringsA(p);
79}
80
81BOOST_FORCEINLINE DWORD_ get_environment_variable(LPCSTR_ name, LPSTR_ buffer, DWORD_ size)
82{
83 return GetEnvironmentVariableA(name, buffer, size);
84}
85
86BOOST_FORCEINLINE BOOL_ set_environment_variable(LPCSTR_ name, LPCSTR_ value)
87{
88 return SetEnvironmentVariableA(name, value);
89}
90
91#endif // !defined( BOOST_NO_ANSI_APIS )
92
93template< >
94BOOST_FORCEINLINE wchar_t* get_environment_strings< wchar_t >()
95{
96 return GetEnvironmentStringsW();
97}
98
99BOOST_FORCEINLINE BOOL_ free_environment_strings(boost::detail::winapi::LPWSTR_ p)
100{
101 return FreeEnvironmentStringsW(p);
102}
103
104BOOST_FORCEINLINE DWORD_ get_environment_variable(LPCWSTR_ name, LPWSTR_ buffer, DWORD_ size)
105{
106 return GetEnvironmentVariableW(name, buffer, size);
107}
108
109BOOST_FORCEINLINE BOOL_ set_environment_variable(LPCWSTR_ name, LPCWSTR_ value)
110{
111 return SetEnvironmentVariableW(name, value);
112}
113
114} // namespace winapi
115} // namespace detail
116} // namespace boost
117
118#endif // BOOST_DETAIL_WINAPI_ENVIRONMENT_HPP_