summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmSystemTools.h')
-rw-r--r--Source/cmSystemTools.h38
1 files changed, 29 insertions, 9 deletions
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 087eca7..1962389 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -8,6 +8,7 @@
#include "cmCryptoHash.h"
#include "cmDuration.h"
#include "cmProcessOutput.h"
+#include "cm_string_view.hxx"
#include "cmsys/Process.h"
#include "cmsys/SystemTools.hxx" // IWYU pragma: export
#include <functional>
@@ -149,26 +150,45 @@ public:
* forced this value. This is not the same as On, but this
* may be considered as "internally switched on".
*/
- static bool IsInternallyOn(const char* val);
+ static bool IsInternallyOn(cm::string_view val);
+ static inline bool IsInternallyOn(const char* val)
+ {
+ if (!val) {
+ return false;
+ }
+ return IsInternallyOn(cm::string_view(val));
+ }
+
/**
- * does a string indicate a true or on value ? This is not the same
- * as ifdef.
+ * Does a string indicate a true or on value? This is not the same as ifdef.
*/
- static bool IsOn(const char* val);
- static bool IsOn(const std::string& val);
+ static bool IsOn(cm::string_view val);
+ inline static bool IsOn(const char* val)
+ {
+ if (!val) {
+ return false;
+ }
+ return IsOn(cm::string_view(val));
+ }
/**
- * does a string indicate a false or off value ? Note that this is
+ * Does a string indicate a false or off value ? Note that this is
* not the same as !IsOn(...) because there are a number of
* ambiguous values such as "/usr/local/bin" a path will result in
* IsON and IsOff both returning false. Note that the special path
* NOTFOUND, *-NOTFOUND or IGNORE will cause IsOff to return true.
*/
- static bool IsOff(const char* val);
- static bool IsOff(const std::string& val);
+ static bool IsOff(cm::string_view val);
+ inline static bool IsOff(const char* val)
+ {
+ if (!val) {
+ return true;
+ }
+ return IsOff(cm::string_view(val));
+ }
//! Return true if value is NOTFOUND or ends in -NOTFOUND.
- static bool IsNOTFOUND(const char* value);
+ static bool IsNOTFOUND(cm::string_view val);
//! Return true if the path is a framework
static bool IsPathToFramework(const std::string& value);