summaryrefslogtreecommitdiffstats
path: root/Source/cmStringAlgorithms.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmStringAlgorithms.h')
-rw-r--r--Source/cmStringAlgorithms.h50
1 files changed, 13 insertions, 37 deletions
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 9ea7491..4ccbb8e 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -14,6 +14,7 @@
#include <cm/string_view>
+#include "cmList.h"
#include "cmRange.h"
#include "cmValue.h"
@@ -92,14 +93,20 @@ std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep);
* Expand the ; separated string @a arg into multiple arguments.
* All found arguments are appended to @a argsOut.
*/
-void cmExpandList(cm::string_view arg, std::vector<std::string>& argsOut,
- bool emptyArgs = false);
+inline void cmExpandList(cm::string_view arg,
+ std::vector<std::string>& argsOut,
+ bool emptyArgs = false)
+{
+ cmList::append(arg, argsOut,
+ emptyArgs ? cmList::EmptyElements::Yes
+ : cmList::EmptyElements::No);
+}
inline void cmExpandList(cmValue arg, std::vector<std::string>& argsOut,
bool emptyArgs = false)
{
- if (arg) {
- cmExpandList(*arg, argsOut, emptyArgs);
- }
+ cmList::append(arg, argsOut,
+ emptyArgs ? cmList::EmptyElements::Yes
+ : cmList::EmptyElements::No);
}
/**
@@ -111,38 +118,7 @@ template <class InputIt>
void cmExpandLists(InputIt first, InputIt last,
std::vector<std::string>& argsOut)
{
- for (; first != last; ++first) {
- cmExpandList(*first, argsOut);
- }
-}
-
-/**
- * Same as cmExpandList but a new vector is created containing
- * the expanded arguments from the string @a arg.
- */
-std::vector<std::string> cmExpandedList(cm::string_view arg,
- bool emptyArgs = false);
-inline std::vector<std::string> cmExpandedList(cmValue arg,
- bool emptyArgs = false)
-{
- if (!arg) {
- return {};
- }
- return cmExpandedList(*arg, emptyArgs);
-}
-
-/**
- * Same as cmExpandList but a new vector is created containing the expanded
- * versions of all arguments in the string range [@a first, @a last).
- */
-template <class InputIt>
-std::vector<std::string> cmExpandedLists(InputIt first, InputIt last)
-{
- std::vector<std::string> argsOut;
- for (; first != last; ++first) {
- cmExpandList(*first, argsOut);
- }
- return argsOut;
+ cmList::append(first, last, argsOut);
}
/** Concatenate string pieces into a single string. */