diff --git a/application/argumentparser.cpp b/application/argumentparser.cpp index 2928ea3..df7a543 100644 --- a/application/argumentparser.cpp +++ b/application/argumentparser.cpp @@ -32,27 +32,6 @@ using namespace CppUtilities::EscapeCodes; */ namespace CppUtilities { -/*! - * \brief Returns whether the specified env variable is set to a non-zero and non-white-space-only value. - */ -std::optional isEnvVariableSet(const char *variableName) -{ - const char *envValue = std::getenv(variableName); - if (!envValue) { - return std::nullopt; - } - for (; *envValue; ++envValue) { - switch (*envValue) { - case '0': - case ' ': - break; - default: - return true; - } - } - return false; -} - /*! * \brief The ArgumentDenotationType enum specifies the type of a given argument denotation. */ diff --git a/application/argumentparserprivate.h b/application/argumentparserprivate.h index 0725135..6a24bb7 100644 --- a/application/argumentparserprivate.h +++ b/application/argumentparserprivate.h @@ -4,8 +4,6 @@ #include "./argumentparser.h" #include "./commandlineutils.h" -#include - namespace CppUtilities { class CPP_UTILITIES_EXPORT ArgumentReader { @@ -58,8 +56,6 @@ inline Wrapper::Wrapper(const char *str, Indentation currentIndentation) { } -std::optional isEnvVariableSet(const char *variableName); - } // namespace CppUtilities #endif // APPLICATION_UTILITIES_ARGUMENTPARSER_PRIVATE_H diff --git a/application/commandlineutils.cpp b/application/commandlineutils.cpp index 331ab74..13eeffe 100644 --- a/application/commandlineutils.cpp +++ b/application/commandlineutils.cpp @@ -43,6 +43,27 @@ bool confirmPrompt(const char *message, Response defaultResponse) } } +/*! + * \brief Returns whether the specified env variable is set to a non-zero and non-white-space-only value. + */ +std::optional isEnvVariableSet(const char *variableName) +{ + const char *envValue = std::getenv(variableName); + if (!envValue) { + return std::nullopt; + } + for (; *envValue; ++envValue) { + switch (*envValue) { + case '0': + case ' ': + break; + default: + return true; + } + } + return false; +} + /*! * \brief Returns the current size of the terminal. * \remarks Unknown members of the returned TerminalSize are set to zero. diff --git a/application/commandlineutils.h b/application/commandlineutils.h index f47b92d..6b0d680 100644 --- a/application/commandlineutils.h +++ b/application/commandlineutils.h @@ -3,6 +3,7 @@ #include "../global.h" +#include #include #ifdef PLATFORM_WINDOWS @@ -18,6 +19,7 @@ namespace CppUtilities { enum class Response { None, Yes, No }; CPP_UTILITIES_EXPORT bool confirmPrompt(const char *message, Response defaultResponse = Response::None); +CPP_UTILITIES_EXPORT std::optional isEnvVariableSet(const char *variableName); #ifdef PLATFORM_WINDOWS CPP_UTILITIES_EXPORT bool handleVirtualTerminalProcessing();