Move helpers functions from cmStringAlgorithms.h to cmValue.h

Helpers functions related to cmValue semantic are now part of
cmValue.h header.
This commit is contained in:
Marc Chevrier
2021-09-21 17:38:59 +02:00
parent edf67dd039
commit 59ad7a1c24
16 changed files with 88 additions and 83 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -12,6 +12,7 @@
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include "cmValue.h"
bool cmAddLibraryCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)

View File

@@ -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"

View File

@@ -17,6 +17,7 @@
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
using namespace cmFSPermissions;

View File

@@ -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"

View File

@@ -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<std::string>& incs);

View File

@@ -8,6 +8,7 @@
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmValue.h"
cmInstalledFile::cmInstalledFile() = default;

View File

@@ -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)

View File

@@ -9,6 +9,7 @@
#include "cmQtAutoGen.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
cmQtAutoGenerator::Logger::Logger()
{

View File

@@ -7,7 +7,6 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"

View File

@@ -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)
{

View File

@@ -25,6 +25,7 @@
#include "cmProcessOutput.h"
#include "cmRange.h"
#include "cmStringAlgorithms.h"
#include "cmValue.h"
#if !defined(CMAKE_BOOTSTRAP)
# include <cm3p/archive.h>

View File

@@ -5,7 +5,6 @@
#include "cmMakefile.h"
#include "cmProperty.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
#include "cmValue.h"
cmTest::cmTest(cmMakefile* mf)

View File

@@ -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();
}

View File

@@ -23,6 +23,7 @@
#include "cmTransformDepfile.h"
#include "cmUVProcessChain.h"
#include "cmUtils.hxx"
#include "cmValue.h"
#include "cmVersion.h"
#include "cmake.h"