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

Method Validate

Source/cmList.cxx:352–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350 }
351
352 bool Validate(std::size_t count) override
353 {
354 this->Start = this->NormalizeIndex(this->Start, count);
355 this->Stop = this->NormalizeIndex(this->Stop, count);
356
357 // Does stepping move us further from the end?
358 if (this->Start > this->Stop) {
359 throw transform_error(
360 cmStrCat("sub-command TRANSFORM, selector FOR "
361 "expects <start> to be no greater than <stop> (",
362 this->Start, " > ", this->Stop, ')'));
363 }
364
365 // compute indexes
366 auto size = (this->Stop - this->Start + 1) / this->Step;
367 if ((this->Stop - this->Start + 1) % this->Step != 0) {
368 size += 1;
369 }
370
371 this->Indexes.resize(size);
372 auto start = this->Start;
373 auto step = this->Step;
374 std::generate(this->Indexes.begin(), this->Indexes.end(),
375 [&start, step]() -> index_type {
376 auto r = start;
377 start += step;
378 return r;
379 });
380
381 return true;
382 }
383
384private:
385 index_type Start, Stop, Step;

Callers

nothing calls this directly

Calls 6

transform_errorClass · 0.85
NormalizeIndexMethod · 0.80
cmStrCatFunction · 0.70
resizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected