summaryrefslogtreecommitdiffstats
path: root/Source/cmValue.h
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-09-21 15:38:59 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-09-21 16:11:00 (GMT)
commit59ad7a1c243022284f8475e0bebbe1864ee23928 (patch)
treee18411eb48077bc54128e29394474bce7a913c5b /Source/cmValue.h
parentedf67dd039f40a4222e41cc15a197cb6395bf885 (diff)
downloadCMake-59ad7a1c243022284f8475e0bebbe1864ee23928.zip
CMake-59ad7a1c243022284f8475e0bebbe1864ee23928.tar.gz
CMake-59ad7a1c243022284f8475e0bebbe1864ee23928.tar.bz2
Move helpers functions from cmStringAlgorithms.h to cmValue.h
Helpers functions related to cmValue semantic are now part of cmValue.h header.
Diffstat (limited to 'Source/cmValue.h')
-rw-r--r--Source/cmValue.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/Source/cmValue.h b/Source/cmValue.h
index c79b997..f96d2f5 100644
--- a/Source/cmValue.h
+++ b/Source/cmValue.h
@@ -234,3 +234,81 @@ inline bool operator>=(cmValue l, std::nullptr_t) noexcept
{
return l.Compare(cmValue{}) >= 0;
}
+
+/**
+ * Does a string indicate a true or ON value? This is not the same as ifdef.
+ */
+inline bool cmIsOn(cm::string_view val)
+{
+ return cmValue::IsOn(val);
+}
+inline bool cmIsOn(const char* val)
+{
+ return cmValue::IsOn(val);
+}
+inline bool cmIsOn(cmValue val)
+{
+ return val.IsOn();
+}
+
+/**
+ * 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.
+ */
+inline bool cmIsOff(cm::string_view val)
+{
+ return cmValue::IsOff(val);
+}
+inline bool cmIsOff(const char* val)
+{
+ return cmValue::IsOff(val);
+}
+inline bool cmIsOff(cmValue val)
+{
+ return val.IsOff();
+}
+
+/** Return true if value is NOTFOUND or ends in -NOTFOUND. */
+inline bool cmIsNOTFOUND(cm::string_view val)
+{
+ return cmValue::IsNOTFOUND(val);
+}
+inline bool cmIsNOTFOUND(cmValue val)
+{
+ return val.IsNOTFOUND();
+}
+
+/** Check for non-empty Property/Variable value. */
+inline bool cmNonempty(cm::string_view val)
+{
+ return !cmValue::IsEmpty(val);
+}
+inline bool cmNonempty(const char* val)
+{
+ return !cmValue::IsEmpty(val);
+}
+inline bool cmNonempty(cmValue val)
+{
+ return !val.IsEmpty();
+}
+
+/**
+ * Does a string indicates that CMake/CPack/CTest internally
+ * forced this value. This is not the same as On, but this
+ * may be considered as "internally switched on".
+ */
+inline bool cmIsInternallyOn(cm::string_view val)
+{
+ return cmValue::IsInternallyOn(val);
+}
+inline bool cmIsInternallyOn(const char* val)
+{
+ return cmValue::IsInternallyOn(val);
+}
+inline bool cmIsInternallyOn(cmValue val)
+{
+ return val.IsInternallyOn();
+}