Albert
Loading...
Searching...
No Matches
desktopentryparser.h
Go to the documentation of this file.
1// Copyright (c) 2024-2024 Manuel Schneider
2
3#pragma once
4#include <QLocale>
5#include <QString>
6#include <albert/export.h>
7#include <map>
8#include <optional>
9
10namespace albert::detail {
11
14class ALBERT_EXPORT DesktopEntryParser
15{
16public:
17
18 DesktopEntryParser(const QString &path);
19
29 QString getString(const QString &section, const QString &key) const;
30
39 QString getLocaleString(const QString &section, const QString &key);
40
52 QString getIconString(const QString &section, const QString &key);
53
62 bool getBoolean(const QString &section, const QString &key);
63
73 double getNumeric(const QString &, const QString &);
74
76 static std::optional<QStringList> splitExec(const QString &s) noexcept;
77
78private:
79
86 QString getRawValue(const QString &section, const QString &key) const;
87
98 QString getEscapedValue(const QString &section, const QString &key) const;
99
100 std::map<QString, std::map<QString,QString>> data;
101 QLocale locale;
102
103};
104
105}