diff options
author | Brad King <brad.king@kitware.com> | 2011-06-08 19:44:44 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-06-08 19:44:44 (GMT) |
commit | 98dc13e5139e53446febd01c754430b9edf09575 (patch) | |
tree | faa2638cee4817ddc92854f0b38dfd82466df1f2 /Source/cmSystemTools.cxx | |
parent | 45adc8e8c16127f9d12b5c59a37fb9eeb492cf74 (diff) | |
parent | f09ba0f1a2dbae3bca99b35b7d8c26c457c5824c (diff) | |
download | CMake-98dc13e5139e53446febd01c754430b9edf09575.zip CMake-98dc13e5139e53446febd01c754430b9edf09575.tar.gz CMake-98dc13e5139e53446febd01c754430b9edf09575.tar.bz2 |
Merge topic 'xcode-source_groups-folders-issue-10039'
f09ba0f Fix style errors added by parent and grandparent
eeeeca1 XCode: Support target folders on XCode.
59ed84e Xcode: Support multiple level nesting of XCode folders (#10039)
d0a403f CMake: Move tokenize to cmSystemTools
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index c40e905..dbb2226 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2919,3 +2919,35 @@ bool cmSystemTools::RepeatedRemoveDirectory(const char* dir) } return false; } + +//---------------------------------------------------------------------------- +std::vector<std::string> cmSystemTools::tokenize(const std::string& str, + const std::string& sep) +{ + std::vector<std::string> tokens; + std::string::size_type tokend = 0; + + do + { + std::string::size_type tokstart=str.find_first_not_of(sep, tokend); + if (tokstart==std::string::npos) + { + break; // no more tokens + } + tokend=str.find_first_of(sep,tokstart); + if (tokend==std::string::npos) + { + tokens.push_back(str.substr(tokstart)); + } + else + { + tokens.push_back(str.substr(tokstart,tokend-tokstart)); + } + } while (tokend!=std::string::npos); + + if (tokens.empty()) + { + tokens.push_back(""); + } + return tokens; +} |