ladybird/Userland/Utilities/pkg/AvailablePort.h
Gurkirat Singh fc8f6c07b4 Utilities/pkg: Integrate LibSemVer for update information
Along with this, Port.h is include which helps generalising common
information for the port package, like it's name and version. With
SemVer complaint versions, it is possible to show positive change
(upgrade) or negative change (downgrade) in the installed ports.

However, for some non-complaint versions (eg. using git commit hash),
non-equality (`!=`) is used to notify upgrade. Since there is no
algorithm (without git history) to check the order of commits, it is
not possible to inform whether it is an upgrade or downgrade.
2024-02-15 18:23:05 +01:00

32 lines
883 B
C++

/*
* Copyright (c) 2023, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "InstalledPort.h"
#include <AK/HashMap.h>
#include <AK/String.h>
#include <AK/StringView.h>
#include <AK/Types.h>
class AvailablePort : public Port {
public:
static void query_details_for_package(HashMap<String, AvailablePort>& available_ports, HashMap<String, InstalledPort> const& installed_ports, StringView package_name, bool verbose);
static ErrorOr<HashMap<String, AvailablePort>> read_available_ports_list();
static ErrorOr<int> update_available_ports_list_file();
AvailablePort(String const& name, String const& version, String const& website)
: Port(name, version)
, m_website(website)
{
}
StringView website() const { return m_website.bytes_as_string_view(); }
private:
String m_website;
};