diff options
author | Chase Douglas <chase.douglas@ubuntu.com> | 2011-12-14 11:10:59 -0800 |
---|---|---|
committer | Chase Douglas <chase.douglas@ubuntu.com> | 2011-12-14 11:10:59 -0800 |
commit | 327d46a503ab1f57134e9d3a56f6792b151e8c03 (patch) | |
tree | bcb51b7bd494f1996e43a87f269b2c64bc8751d0 /include | |
parent | 8b2947df181dba16e07bd399d33ef0ae60aebdeb (diff) |
Make Process::GetEnv and SetEnv static methods
They do not modify or use a Process object. They are merely helper
functions.
Diffstat (limited to 'include')
-rw-r--r-- | include/xorg/gtest/process.h | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/include/xorg/gtest/process.h b/include/xorg/gtest/process.h index 9cd207e..4359f21 100644 --- a/include/xorg/gtest/process.h +++ b/include/xorg/gtest/process.h @@ -56,6 +56,29 @@ namespace testing { class Process { public: /** + * Helper function to adjust the environment of the current process. + * + * @param [in] name Name of the environment variable. + * @param [in] value Value of the environment variable. + * @param [in] overwrite Whether to overwrite the value of existing env + * variables. + * + * @throws std::runtime_error if adjusting the environment does not succeed. + */ + static void SetEnv(const std::string& name, const std::string& value, + bool overwrite); + + /** + * Helper function to query the environment of the current process. + * + * @param [in] name The name of the environment variable. + * @param [out] exists If not NULL, the variable will be set to true if the + * environment variable exists and to false otherwise. + * @returns The value of the environment variable, or an empty string. + */ + static std::string GetEnv(const std::string& name, bool* exists = NULL); + + /** * Creates a child-process that is in a terminated state. */ Process(); @@ -115,27 +138,6 @@ class Process { bool Kill(); /** - * Adjusts the environment of the child process. - * - * @param [in] name Name of the environment variable. - * @param [in] value Value of the environment variable. - * @param [in] overwrite Whether to overwrite the value of existing env variables. - * - * @throws std::runtime_error if adjusting the environment does not succeed. - */ - void SetEnv(const std::string& name, const std::string& value, bool overwrite); - - /** - * Queries the environment of the child process. - * - * @param [in] name The name of the environment variable. - * @param [out] exists If not NULL, the variable will be set to true if the - * environment variable exists and to false otherwise. - * @returns The value of the environment variable, or an empty string. - */ - std::string GetEnv(const std::string& name, bool* exists = NULL) const; - - /** * Accesses the pid of the child process. * * @returns The pid of the child process or -1. |