summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibConfig
diff options
context:
space:
mode:
authorfaxe1008 <fabianblatz@gmail.com>2021-11-16 20:08:29 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-18 09:08:51 +0100
commitf10036b7c5c4cf4a9b7d032f1b6569c887cb6ccb (patch)
treecb18488e44d5f3e100d342ff53befa4e0b428b11 /Userland/Libraries/LibConfig
parent116d89eec643bf6734576f2d21e6e14f493c6b32 (diff)
downloadserenity-f10036b7c5c4cf4a9b7d032f1b6569c887cb6ccb.zip
LibConfig: Add list methods for groups and keys
Use the methods exposed by ConfigServer to list groups and keys.
Diffstat (limited to 'Userland/Libraries/LibConfig')
-rw-r--r--Userland/Libraries/LibConfig/Client.cpp10
-rw-r--r--Userland/Libraries/LibConfig/Client.h13
2 files changed, 23 insertions, 0 deletions
diff --git a/Userland/Libraries/LibConfig/Client.cpp b/Userland/Libraries/LibConfig/Client.cpp
index bae912a9e3..3394d22b58 100644
--- a/Userland/Libraries/LibConfig/Client.cpp
+++ b/Userland/Libraries/LibConfig/Client.cpp
@@ -30,6 +30,16 @@ void Client::monitor_domain(String const& domain)
async_monitor_domain(domain);
}
+Vector<String> Client::list_keys(StringView domain, StringView group)
+{
+ return list_config_keys(domain, group);
+}
+
+Vector<String> Client::list_groups(StringView domain)
+{
+ return list_config_groups(domain);
+}
+
String Client::read_string(StringView domain, StringView group, StringView key, StringView fallback)
{
return read_string_value(domain, group, key).value_or(fallback);
diff --git a/Userland/Libraries/LibConfig/Client.h b/Userland/Libraries/LibConfig/Client.h
index 04e33fb94f..6f01a05aa2 100644
--- a/Userland/Libraries/LibConfig/Client.h
+++ b/Userland/Libraries/LibConfig/Client.h
@@ -24,6 +24,9 @@ public:
void pledge_domains(Vector<String> const&);
void monitor_domain(String const&);
+ Vector<String> list_groups(StringView domain);
+ Vector<String> list_keys(StringView domain, StringView group);
+
String read_string(StringView domain, StringView group, StringView key, StringView fallback);
i32 read_i32(StringView domain, StringView group, StringView key, i32 fallback);
bool read_bool(StringView domain, StringView group, StringView key, bool fallback);
@@ -47,6 +50,16 @@ private:
void notify_removed_key(String const& domain, String const& group, String const& key) override;
};
+inline Vector<String> list_groups(StringView domain)
+{
+ return Client::the().list_groups(domain);
+}
+
+inline Vector<String> list_keys(StringView domain, StringView group)
+{
+ return Client::the().list_keys(domain, group);
+}
+
inline String read_string(StringView domain, StringView group, StringView key, StringView fallback = {})
{
return Client::the().read_string(domain, group, key, fallback);