MCPcopy Create free account
hub / github.com/Kitware/CMake / cmTokenize

Function cmTokenize

Source/cmStringAlgorithms.h:150–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 */
149template <typename StringT, typename OutIt, typename Sep = char>
150void cmTokenize(OutIt outIt, cm::string_view str, Sep sep,
151 cmTokenizerMode mode)
152{
153 auto hasTokens = false;
154 // clang-format off
155 for (auto start = str.find_first_not_of(sep)
156 , end = str.find_first_of(sep, start)
157 ; start != cm::string_view::npos
158 ; start = str.find_first_not_of(sep, end)
159 , end = str.find_first_of(sep, start)
160 , hasTokens = true
161 ) {
162 *outIt++ = StringT{ str.substr(start, end - start) };
163 }
164 // clang-format on
165 if (!hasTokens && mode == cmTokenizerMode::Legacy) {
166 *outIt = StringT{};
167 }
168}
169
170/**
171 * \brief Extract tokens that are separated by any of the

Callers 14

testStringAlgorithmsFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
cmComputeLinkDependsMethod · 0.85
ParseGeneratorToolsetMethod · 0.85
ParseKnownAttributesMethod · 0.85
CreateOrGetPBXGroupMethod · 0.85
ParseGeneratorToolsetMethod · 0.85

Calls 3

find_first_not_ofMethod · 0.80
find_first_ofMethod · 0.80
substrMethod · 0.45

Tested by 1

testStringAlgorithmsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…