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

Method CheckValue

Source/cmFileCopier.cxx:303–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303bool cmFileCopier::CheckValue(std::string const& arg)
304{
305 switch (this->Doing) {
306 case DoingFiles:
307 this->Files.push_back(arg);
308 break;
309 case DoingDestination:
310 if (arg.empty() || cmSystemTools::FileIsFullPath(arg)) {
311 this->Destination = arg;
312 } else {
313 this->Destination =
314 cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/', arg);
315 }
316 this->Doing = DoingNone;
317 break;
318 case DoingFilesFromDir:
319 if (cmSystemTools::FileIsFullPath(arg)) {
320 this->FilesFromDir = arg;
321 } else {
322 this->FilesFromDir =
323 cmStrCat(this->Makefile->GetCurrentSourceDirectory(), '/', arg);
324 }
325 cmSystemTools::ConvertToUnixSlashes(this->FilesFromDir);
326 this->Doing = DoingNone;
327 break;
328 case DoingPattern: {
329 // Convert the pattern to a regular expression. Require a
330 // leading slash and trailing end-of-string in the matched
331 // string to make sure the pattern matches only whole file
332 // names.
333 std::string regex =
334 cmStrCat('/', cmsys::Glob::PatternToRegex(arg, false), '$');
335 this->MatchRules.emplace_back(regex);
336 this->CurrentMatchRule = &*(this->MatchRules.end() - 1);
337 if (this->CurrentMatchRule->Regex.is_valid()) {
338 this->Doing = DoingNone;
339 } else {
340 std::ostringstream e;
341 e << "could not compile PATTERN \"" << arg << "\".";
342 this->Status.SetError(e.str());
343 this->Doing = DoingError;
344 }
345 } break;
346 case DoingRegex:
347 this->MatchRules.emplace_back(arg);
348 this->CurrentMatchRule = &*(this->MatchRules.end() - 1);
349 if (this->CurrentMatchRule->Regex.is_valid()) {
350 this->Doing = DoingNone;
351 } else {
352 std::ostringstream e;
353 e << "could not compile REGEX \"" << arg << "\".";
354 this->Status.SetError(e.str());
355 this->Doing = DoingError;
356 }
357 break;
358 case DoingPermissionsFile:
359 if (!this->CheckPermissions(arg, this->FilePermissions)) {
360 this->Doing = DoingError;

Callers 1

ParseMethod · 0.95

Calls 8

CheckPermissionsMethod · 0.95
push_backMethod · 0.80
emplace_backMethod · 0.80
strMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45
endMethod · 0.45
SetErrorMethod · 0.45

Tested by

no test coverage detected