kazbek/include/katja/database.hpp

40 lines
1.1 KiB
C++
Raw Normal View History

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
2025-03-06 22:20:38 +01:00
#pragma once
#include <string>
#include <map>
2025-03-06 22:20:38 +01:00
namespace katja
{
constexpr const char *database = "/var/lib/pkgtools/packages";
class database_package
{
database_package(std::string&& name, std::string&& version,
std::string&& architecture, std::string&& build_tag);
static database_package create_database_package(const std::string& fullname);
public:
const std::string name;
2025-03-12 13:04:58 +01:00
const std::string version;
const std::string architecture;
const std::string build_tag;
2025-03-06 22:20:38 +01:00
database_package(const std::string& fullname);
bool operator<(const database_package& that) const;
bool operator>(const database_package& that) const;
2025-03-06 22:20:38 +01:00
std::string to_string() const;
};
2025-03-12 13:04:58 +01:00
using package_database = std::multimap<std::string, database_package>;
package_database read_installed_database();
2025-03-06 22:20:38 +01:00
}