blob: ba0665f05a205c41351d1351cdcf27ec15e65c94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright (C) 2018-2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <fstream>
#include <map>
#include <string>
static std::map<std::string, std::string> parseConfig(const std::string& configName, char comment = '#') {
std::map<std::string, std::string> config = {};
std::ifstream file(configName);
if (!file.is_open()) {
return config;
}
std::string key, value;
while (file >> key >> value) {
if (key.empty() || key[0] == comment) {
continue;
}
config[key] = value;
}
return config;
}
|