// The sdc file is supposed to be small, so read fully into memory for simplicity. if (!ReadFileToString(filename, &reader->content_)) {
*error_msg = ART_FORMAT("Failed to load sdc file '{}': {}", filename, strerror(errno)); return nullptr;
}
std::vector<std::string_view> lines;
Split(reader->content_, '\n', &lines);
std::unordered_map<std::string_view, std::string_view> map; for (std::string_view line : lines) {
size_t pos = line.find('='); if (pos == std::string_view::npos || pos == 0) {
*error_msg = ART_FORMAT("Malformed line '{}' in sdc file '{}'", line, filename); return nullptr;
} if (!map.try_emplace(line.substr(0, pos), line.substr(pos + 1)).second) {
*error_msg = ART_FORMAT("Duplicate key '{}' in sdc file '{}'", line.substr(0, pos), filename); return nullptr;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.