summaryrefslogtreecommitdiff
path: root/src/package.h
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2023-04-01 14:16:44 +0200
committerEugen Wissner <belka@caraus.de>2023-04-01 14:17:08 +0200
commitf46a16b4a0d50b6512df2b312f7f800a9a963ca2 (patch)
tree8b385dc31c90065ba8e5a970dec9c931d68b7f43 /src/package.h
parent0385dbbe53cbeb89b541fa6ae659540a261bc69b (diff)
downloadslackbuilder-f46a16b4a0d50b6512df2b312f7f800a9a963ca2.tar.gz
Add an utility to list all installed packages
Diffstat (limited to 'src/package.h')
-rw-r--r--src/package.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/package.h b/src/package.h
new file mode 100644
index 0000000..5ffd060
--- /dev/null
+++ b/src/package.h
@@ -0,0 +1,27 @@
+#include <string>
+#include <optional>
+#include <unordered_map>
+
+namespace katja
+{
+ class package
+ {
+ std::string m_name;
+ std::string m_version;
+ std::string m_architecture;
+ std::string m_tag;
+
+ public:
+ explicit package(const std::string& name, const std::string& version,
+ const std::string& architecture, const std::string& tag);
+
+ const std::string& name() const noexcept;
+ const std::string& version() const noexcept;
+ const std::string& architecture() const noexcept;
+ const std::string& tag() const noexcept;
+
+ static std::optional<package> parse(const std::string& full_name) noexcept;
+ };
+
+ std::unordered_map<std::string, package> read_package_database();
+}