process-cpp
3.0.0
A simple convenience library for handling processes in C++11.
|
Go to the documentation of this file.
19 #ifndef CORE_POSIX_THIS_PROCESS_H_
20 #define CORE_POSIX_THIS_PROCESS_H_
27 #include <system_error>
34 namespace this_process
43 const std::function<
void(
const std::string&,
const std::string&)>& functor) noexcept(
true);
60 const std::string& key,
61 const std::string& default_value = std::string()) noexcept(
true);
77 std::error_code& se) noexcept(
true);
86 const std::string& value);
95 const std::string &value,
96 std::error_code& se) noexcept(
true);
128 #endif // CORE_POSIX_THIS_PROCESS_H_
CORE_POSIX_DLL_PUBLIC std::string get(const std::string &key, const std::string &default_value=std::string()) noexcept(true)
get queries the value of an environment variable.
CORE_POSIX_DLL_PUBLIC Process instance() noexcept(true)
Returns a Process instance corresponding to this process.
#define CORE_POSIX_DLL_PUBLIC
CORE_POSIX_DLL_PUBLIC bool set(const std::string &key, const std::string &value, std::error_code &se) noexcept(true)
set will adjust the contents of the variable identified by key to the provided value.
CORE_POSIX_DLL_PUBLIC void set_or_throw(const std::string &key, const std::string &value)
set_or_throw will adjust the contents of the variable identified by key to the provided value.
CORE_POSIX_DLL_PUBLIC std::string get_or_throw(const std::string &key)
get queries the value of an environment variable.
CORE_POSIX_DLL_PUBLIC std::ostream & cerr() noexcept(true)
Access this process's stderr.
CORE_POSIX_DLL_PUBLIC std::istream & cin() noexcept(true)
Access this process's stdin.
CORE_POSIX_DLL_PUBLIC std::ostream & cout() noexcept(true)
Access this process's stdout.
CORE_POSIX_DLL_PUBLIC void for_each(const std::function< void(const std::string &, const std::string &)> &functor) noexcept(true)
for_each invokes a functor for every key-value pair in the environment.
CORE_POSIX_DLL_PUBLIC bool unset(const std::string &key, std::error_code &se) noexcept(true)
unset removes the variable with name key from the environment.
CORE_POSIX_DLL_PUBLIC Process parent() noexcept(true)
Query the parent of the process.
CORE_POSIX_DLL_PUBLIC void unset_or_throw(const std::string &key)
unset_or_throw removes the variable with name key from the environment.
The Process class models a process and possible operations on it.