From 2f6495e24e57cd4a03f38e615cc60177e89afb96 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sun, 11 Aug 2019 12:06:19 +0200 Subject: cmSystemTools: Remove ExpandListArgument methods --- Source/cmSystemTools.cxx | 73 ------------------------------------------------ Source/cmSystemTools.h | 43 ---------------------------- 2 files changed, 116 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ee60f16..7d9b3b9 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1089,79 +1089,6 @@ void cmSystemTools::GlobDirs(const std::string& path, } } -void cmSystemTools::ExpandListArgument(cm::string_view arg, - std::vector& 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 cmSystemTools::ExpandedListArgument( - cm::string_view arg, bool emptyArgs) -{ - std::vector argsOut; - ExpandListArgument(arg, argsOut, emptyArgs); - return argsOut; -} - bool cmSystemTools::SimpleGlob(const std::string& glob, std::vector& files, int type /* = 0 */) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 99610eb..c713783 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -29,49 +29,6 @@ public: typedef cmProcessOutput::Encoding Encoding; /** - * Expand the ; separated string @a arg into multiple arguments. - * All found arguments are appended to @a argsOut. - */ - static void ExpandListArgument(cm::string_view arg, - std::vector& argsOut, - bool emptyArgs = false); - - /** - * Expand out any arguments in the string range [@a first, @a last) that have - * ; separated strings into multiple arguments. All found arguments are - * appended to @a argsOut. - */ - template - static void ExpandLists(InputIt first, InputIt last, - std::vector& argsOut) - { - for (; first != last; ++first) { - cmExpandList(*first, argsOut); - } - } - - /** - * Same as ExpandListArgument but a new vector is created containing - * the expanded arguments from the string @a arg. - */ - static std::vector ExpandedListArgument(cm::string_view arg, - bool emptyArgs = false); - - /** - * Same as ExpandList but a new vector is created containing the expanded - * versions of all arguments in the string range [@a first, @a last). - */ - template - static std::vector ExpandedLists(InputIt first, InputIt last) - { - std::vector argsOut; - for (; first != last; ++first) { - ExpandListArgument(*first, argsOut); - } - return argsOut; - } - - /** * Look for and replace registry values in a string */ static void ExpandRegistryValues(std::string& source, -- cgit v0.12