From 59ad7a1c243022284f8475e0bebbe1864ee23928 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Tue, 21 Sep 2021 17:38:59 +0200 Subject: Move helpers functions from cmStringAlgorithms.h to cmValue.h Helpers functions related to cmValue semantic are now part of cmValue.h header. --- Source/CTest/cmCTestGIT.cxx | 1 + Source/CTest/cmCTestVC.cxx | 2 +- Source/cmAddLibraryCommand.cxx | 1 + Source/cmComputeTargetDepends.cxx | 1 - Source/cmFileInstaller.cxx | 1 + Source/cmGlobalCommonGenerator.cxx | 1 - Source/cmIncludeDirectoryCommand.cxx | 1 + Source/cmInstalledFile.cxx | 1 + Source/cmOutputConverter.cxx | 1 + Source/cmQtAutoGenerator.cxx | 1 + Source/cmSiteNameCommand.cxx | 1 - Source/cmStringAlgorithms.h | 78 ------------------------------------ Source/cmSystemTools.cxx | 1 + Source/cmTest.cxx | 1 - Source/cmValue.h | 78 ++++++++++++++++++++++++++++++++++++ Source/cmcmd.cxx | 1 + 16 files changed, 88 insertions(+), 83 deletions(-) diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 568b091..d85edcc 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -18,6 +18,7 @@ #include "cmProcessTools.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmValue.h" static unsigned int cmCTestGITVersion(unsigned int epic, unsigned int major, unsigned int minor, unsigned int fix) diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 452d714..423b506 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -10,8 +10,8 @@ #include "cmsys/Process.h" #include "cmCTest.h" -#include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmValue.h" #include "cmXMLWriter.h" cmCTestVC::cmCTestVC(cmCTest* ct, std::ostream& log) diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 92e04e4..a5d1f6a 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -12,6 +12,7 @@ #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmTarget.h" +#include "cmValue.h" bool cmAddLibraryCommand(std::vector const& args, cmExecutionStatus& status) diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index d85dea3..2f29610 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -22,7 +22,6 @@ #include "cmSourceFileLocationKind.h" #include "cmState.h" #include "cmStateTypes.h" -#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetDepend.h" diff --git a/Source/cmFileInstaller.cxx b/Source/cmFileInstaller.cxx index 0d8ba2d..9bfbd13 100644 --- a/Source/cmFileInstaller.cxx +++ b/Source/cmFileInstaller.cxx @@ -17,6 +17,7 @@ #include "cmMakefile.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmValue.h" using namespace cmFSPermissions; diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx index 31ff52f..3ae66f0 100644 --- a/Source/cmGlobalCommonGenerator.cxx +++ b/Source/cmGlobalCommonGenerator.cxx @@ -14,7 +14,6 @@ #include "cmStateDirectory.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" -#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmValue.h" #include "cmake.h" diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index b408f72..23427a1 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -13,6 +13,7 @@ #include "cmMakefile.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmValue.h" static void GetIncludes(cmMakefile& mf, const std::string& arg, std::vector& incs); diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index 32395d1..0974eea 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -8,6 +8,7 @@ #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmStringAlgorithms.h" +#include "cmValue.h" cmInstalledFile::cmInstalledFile() = default; diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 840fdb9..bda2fe5 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -12,6 +12,7 @@ #include "cmStateDirectory.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmValue.h" namespace { bool PathEqOrSubDir(std::string const& a, std::string const& b) diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 568926e..e5c7bda 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -9,6 +9,7 @@ #include "cmQtAutoGen.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +#include "cmValue.h" cmQtAutoGenerator::Logger::Logger() { diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 34fdefe..61d1c30 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -7,7 +7,6 @@ #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmStateTypes.h" -#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmValue.h" diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h index fd5febf..492e588 100644 --- a/Source/cmStringAlgorithms.h +++ b/Source/cmStringAlgorithms.h @@ -219,84 +219,6 @@ 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". - */ -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(); -} - -/** 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(); -} - -/** 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(); -} - -/** - * 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(); -} - /** Returns true if string @a str starts with the character @a prefix. */ inline bool cmHasPrefix(cm::string_view str, char prefix) { diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 27cb90f..75a5a8d 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -25,6 +25,7 @@ #include "cmProcessOutput.h" #include "cmRange.h" #include "cmStringAlgorithms.h" +#include "cmValue.h" #if !defined(CMAKE_BOOTSTRAP) # include diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 5618487..7c0f9e7 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -5,7 +5,6 @@ #include "cmMakefile.h" #include "cmProperty.h" #include "cmState.h" -#include "cmStringAlgorithms.h" #include "cmValue.h" cmTest::cmTest(cmMakefile* mf) 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(); +} diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 3e36f97..4eb98b9 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -23,6 +23,7 @@ #include "cmTransformDepfile.h" #include "cmUVProcessChain.h" #include "cmUtils.hxx" +#include "cmValue.h" #include "cmVersion.h" #include "cmake.h" -- cgit v0.12