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

Method ParseFile

Source/cmListFileCache.cxx:112–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112bool cmListFileParser::ParseFile(char const* filename)
113{
114 this->FileName = filename;
115
116#ifdef _WIN32
117 std::string expandedFileName = cmsys::Encoding::ToNarrow(
118 cmSystemTools::ConvertToWindowsExtendedPath(filename));
119 filename = expandedFileName.c_str();
120#endif
121
122 // Open the file.
123 cmListFileLexer_BOM bom;
124 if (!cmListFileLexer_SetFileName(this->Lexer.get(), filename, &bom)) {
125 this->IssueFileOpenError("cmListFileCache: error can not open file.");
126 return false;
127 }
128
129 // Verify the Byte-Order-Mark, if any.
130 if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) {
131 cmListFileLexer_SetFileName(this->Lexer.get(), nullptr, nullptr);
132 this->IssueFileOpenError(
133 "File starts with a Byte-Order-Mark that is not UTF-8.");
134 return false;
135 }
136
137 return this->Parse();
138}
139
140bool cmListFileParser::ParseString(cm::string_view str,
141 char const* virtual_filename)

Callers

nothing calls this directly

Calls 6

IssueFileOpenErrorMethod · 0.95
ParseMethod · 0.95
c_strMethod · 0.80
FileExistsFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected