summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenerators.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-08-31 14:03:52 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-09-07 15:53:19 (GMT)
commit761b3d79746ab91219d6478a021ba3a1c56f05c8 (patch)
tree1c6891affc7c5a75590295934c6860ce4823bf45 /Source/cmQtAutoGenerators.cxx
parent84658539bca3d0d45873872007b01a45712ba621 (diff)
downloadCMake-761b3d79746ab91219d6478a021ba3a1c56f05c8.zip
CMake-761b3d79746ab91219d6478a021ba3a1c56f05c8.tar.gz
CMake-761b3d79746ab91219d6478a021ba3a1c56f05c8.tar.bz2
Autogen: Add functions to read/write a list of lists
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r--Source/cmQtAutoGenerators.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 7774a00..3369f65 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -75,6 +75,43 @@ static void InfoGet(cmMakefile* makefile, const char* key,
cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
}
+static std::vector<std::string> InfoGetList(cmMakefile* makefile,
+ const char* key)
+{
+ std::vector<std::string> list;
+ cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
+ return list;
+}
+
+static std::vector<std::vector<std::string>> InfoGetLists(cmMakefile* makefile,
+ const char* key)
+{
+ std::vector<std::vector<std::string>> lists;
+ {
+ const std::string value = makefile->GetSafeDefinition(key);
+ std::string::size_type pos = 0;
+ while (pos < value.size()) {
+ std::string::size_type next = value.find(cmQtAutoGen::listSep, pos);
+ std::string::size_type length =
+ (next != std::string::npos) ? next - pos : value.size() - pos;
+ // Remove enclosing braces
+ if (length >= 2) {
+ std::string::const_iterator itBeg = value.begin() + (pos + 1);
+ std::string::const_iterator itEnd = itBeg + (length - 2);
+ {
+ std::string subValue(itBeg, itEnd);
+ std::vector<std::string> list;
+ cmSystemTools::ExpandListArgument(subValue, list);
+ lists.push_back(std::move(list));
+ }
+ }
+ pos += length;
+ pos += cmQtAutoGen::listSep.size();
+ }
+ }
+ return lists;
+}
+
static void InfoGetConfig(cmMakefile* makefile, const char* key,
const std::string& config, std::string& value)
{