summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.h
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-07-23 10:04:41 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-07-24 17:31:14 (GMT)
commit4ff0bb054b65ac332fed3272afac8142599b6464 (patch)
treed7b3f46a7aa09c33b41feabc99a933b5612c05f3 /Source/cmSystemTools.h
parent65d3ea2c7f737c01b426d73f57167f5ad60c095c (diff)
downloadCMake-4ff0bb054b65ac332fed3272afac8142599b6464.zip
CMake-4ff0bb054b65ac332fed3272afac8142599b6464.tar.gz
CMake-4ff0bb054b65ac332fed3272afac8142599b6464.tar.bz2
cmSystemTools: Make IsInternallyOn, IsON and IsOff cm::string_view based
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 a9c03bd..5ce6a48 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);