diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2023-04-17 10:32:18 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2023-04-23 12:48:36 (GMT) |
commit | 51b0d45d9120d4bca5c7285d5e6b2f80db5a8310 (patch) | |
tree | d1ab83eb1e0e8e99e2a06dd413151187af77f6d4 /Source/cmStringAlgorithms.cxx | |
parent | c36f03bfecbb8c2331b66fec615c6d30917ae64d (diff) | |
download | CMake-51b0d45d9120d4bca5c7285d5e6b2f80db5a8310.zip CMake-51b0d45d9120d4bca5c7285d5e6b2f80db5a8310.tar.gz CMake-51b0d45d9120d4bca5c7285d5e6b2f80db5a8310.tar.bz2 |
cmExpandList and cmExpandLists rely on cmList class
Diffstat (limited to 'Source/cmStringAlgorithms.cxx')
-rw-r--r-- | Source/cmStringAlgorithms.cxx | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx index 66bf383..968dd3c 100644 --- a/Source/cmStringAlgorithms.cxx +++ b/Source/cmStringAlgorithms.cxx @@ -80,70 +80,6 @@ std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep) return tokens; } -void cmExpandList(cm::string_view arg, std::vector<std::string>& argsOut, - bool emptyArgs) -{ - // If argument is empty, it is an empty list. - if (!emptyArgs && arg.empty()) { - return; - } - - // if there are no ; in the name then just copy the current string - if (arg.find(';') == cm::string_view::npos) { - argsOut.emplace_back(arg); - return; - } - - std::string newArg; - // Break the string at non-escaped semicolons not nested in []. - int squareNesting = 0; - cm::string_view::iterator last = arg.begin(); - cm::string_view::iterator const cend = arg.end(); - for (cm::string_view::iterator c = last; c != cend; ++c) { - switch (*c) { - case '\\': { - // We only want to allow escaping of semicolons. Other - // escapes should not be processed here. - cm::string_view::iterator cnext = c + 1; - if ((cnext != cend) && *cnext == ';') { - newArg.append(last, c); - // Skip over the escape character - last = cnext; - c = cnext; - } - } break; - case '[': { - ++squareNesting; - } break; - case ']': { - --squareNesting; - } break; - case ';': { - // Break the string here if we are not nested inside square - // brackets. - if (squareNesting == 0) { - newArg.append(last, c); - // Skip over the semicolon - last = c + 1; - if (!newArg.empty() || emptyArgs) { - // Add the last argument if the string is not empty. - argsOut.push_back(newArg); - newArg.clear(); - } - } - } break; - default: { - // Just append this character. - } break; - } - } - newArg.append(last, cend); - if (!newArg.empty() || emptyArgs) { - // Add the last argument if the string is not empty. - argsOut.push_back(std::move(newArg)); - } -} - std::vector<std::string> cmExpandedList(cm::string_view arg, bool emptyArgs) { std::vector<std::string> argsOut; |