summaryrefslogtreecommitdiff
path: root/util/coreboot-configurator/src/application/Util.h
blob: 55553f29816e3b339495d2e837c44895370ac952 (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
/* SPDX-License-Identifier: GPL-2.0-only */

#pragma once

#include <QIODevice>
#include <QMap>
#include <QString>

namespace Util {
	inline QMap<QString,QString> parseParameters(QIODevice& dev){
		QString curr_line;
		QMap<QString, QString> result;

		while (!dev.atEnd()) {
			curr_line = dev.readLine().trimmed();

			auto split = curr_line.split('=');
			if(split.size()!=2){
				continue;
			}

			result.insert(split[0].trimmed(), split[1].trimmed());
		}
		return result;
	}
}