diff options
author | Brad King <brad.king@kitware.com> | 2019-08-19 19:03:41 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-08-19 19:03:53 (GMT) |
commit | 0f914b7f26b80163c86cd07959d0f32912ce2fcc (patch) | |
tree | 071a4f3958785ae75913221ac77c9a2bec8305e4 /Source/cmStringAlgorithms.h | |
parent | e977867a1245309b7fbd0e3faaff26c68087f491 (diff) | |
parent | 3b6c62be238f48b23d7dad302702f723dc5ef89c (diff) | |
download | CMake-0f914b7f26b80163c86cd07959d0f32912ce2fcc.zip CMake-0f914b7f26b80163c86cd07959d0f32912ce2fcc.tar.gz CMake-0f914b7f26b80163c86cd07959d0f32912ce2fcc.tar.bz2 |
Merge topic 'cmStringAlgorithms_IsOn'
3b6c62be23 cmSystemTools: Remove IsInternallyOn, IsNOTFOUND, IsOn, IsOff
20e580be01 Source sweep: Use cmIsOn instead of cmSystemTools::IsOn
5b7650216b cmStringAlgorithms: Add cmIsInternallyOn, cmIsNOTFOUND, cmIsOn, cmIsOff
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3691
Diffstat (limited to 'Source/cmStringAlgorithms.h')
-rw-r--r-- | Source/cmStringAlgorithms.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h index 223d712..5b8b878 100644 --- a/Source/cmStringAlgorithms.h +++ b/Source/cmStringAlgorithms.h @@ -180,6 +180,51 @@ std::string cmWrap(char prefix, Range const& rng, char suffix, sep); } +/** + * 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". + */ +bool cmIsInternallyOn(cm::string_view val); +inline bool cmIsInternallyOn(const char* val) +{ + if (!val) { + return false; + } + return cmIsInternallyOn(cm::string_view(val)); +} + +/** Return true if value is NOTFOUND or ends in -NOTFOUND. */ +bool cmIsNOTFOUND(cm::string_view val); + +/** + * Does a string indicate a true or ON value? This is not the same as ifdef. + */ +bool cmIsOn(cm::string_view val); +inline bool cmIsOn(const char* val) +{ + if (!val) { + return false; + } + return cmIsOn(cm::string_view(val)); +} + +/** + * 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. + */ +bool cmIsOff(cm::string_view val); +inline bool cmIsOff(const char* val) +{ + if (!val) { + return true; + } + return cmIsOff(cm::string_view(val)); +} + /** Returns true if string @a str starts with the character @a prefix. */ inline bool cmHasPrefix(cm::string_view str, char prefix) { |