MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / addFilesToList

Function addFilesToList

cli/cmdlineparser.cpp:68–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66#endif
67
68static bool addFilesToList(const std::string& fileList, std::vector<std::string>& pathNames)
69{
70 std::istream *files;
71 std::ifstream infile;
72 if (fileList == "-") { // read from stdin
73 files = &std::cin;
74 } else {
75 infile.open(fileList);
76 if (!infile.is_open())
77 return false;
78 files = &infile;
79 }
80 std::string fileName;
81 while (std::getline(*files, fileName)) { // next line
82 if (!fileName.empty()) {
83 pathNames.emplace_back(std::move(fileName));
84 }
85 }
86
87 return true;
88}
89
90static bool addIncludePathsToList(const std::string& fileList, std::list<std::string>& pathNames)
91{

Callers 1

parseFromArgsMethod · 0.85

Calls 3

getlineFunction · 0.85
openMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected