summaryrefslogtreecommitdiffstats
path: root/Source/cmStringAlgorithms.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmStringAlgorithms.h')
-rw-r--r--Source/cmStringAlgorithms.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index a5ecca7..a1ff304 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -20,6 +20,20 @@
/** String range type. */
using cmStringRange = cmRange<std::vector<std::string>::const_iterator>;
+/** Check for non-empty string. */
+inline bool cmNonempty(const char* str)
+{
+ return str && *str;
+}
+inline bool cmNonempty(cm::string_view str)
+{
+ return !str.empty();
+}
+inline bool cmNonempty(std::string const* str)
+{
+ return str && !str->empty();
+}
+
/** Callable string comparison struct. */
struct cmStrCmp
{