summaryrefslogtreecommitdiff
path: root/include/libfud.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/libfud.hpp')
-rw-r--r--include/libfud.hpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/libfud.hpp b/include/libfud.hpp
index 5bc1630..bff791d 100644
--- a/include/libfud.hpp
+++ b/include/libfud.hpp
@@ -19,6 +19,7 @@
#define LIBFUD_HPP
#include "fud_array.hpp"
+#include "fud_allocator.hpp"
#include "fud_result.hpp"
#include "fud_status.hpp"
#include "fud_string.hpp"
@@ -43,12 +44,13 @@ FUD fud();
* \brief Get an environmental variable if it exists.
*
* \param[in] name The name of the variable to look up.
+ * \param[in] allocator The allocator used by the string returned.
*
* \retstmt The value of the string bound to the variable if it exists.
* \retcode FudStatus::NullPointer if name is a null pointer.
* \retcode FudStatus::NotFound if no binding for the variable exists.
*/
-Result<String, FudStatus> getEnv(const char* name);
+Result<String, FudStatus> getEnv(const char* name, Allocator* allocator= &globalFudAllocator);
template <typename T>
concept CStringRepr = requires(T strObj) {
@@ -56,9 +58,9 @@ concept CStringRepr = requires(T strObj) {
};
template <CStringRepr T>
-Result<String, FudStatus> getEnv(const T& name)
+Result<String, FudStatus> getEnv(const T& name, Allocator* allocator = &globalFudAllocator)
{
- return getEnv(name.c_str());
+ return getEnv(name.c_str(), allocator);
}
} // namespace fud