SlHelpers
Loading...
Searching...
No Matches
CVE2Bugzilla.h
1// SPDX-License-Identifier: GPL-2.0-only
2
3#pragma once
4
5#include <filesystem>
6#include <optional>
7#include <unordered_map>
8#include <string>
9
10#include "../helpers/String.h"
11
12namespace SlCVEs {
13
17class CVE2Bugzilla {
18public:
20 using Map = std::unordered_map<std::string, std::string, SlHelpers::String::Hash,
22
23 CVE2Bugzilla() = delete;
24
30 static std::optional<CVE2Bugzilla> create(const std::filesystem::path &cve2bugzilla) noexcept;
31
37 std::string get_bsc(std::string_view cve_number) const;
38
44 std::string get_cve(std::string_view bsc_number) const;
45private:
46 CVE2Bugzilla(Map cve_bsc_map, Map bsc_cve_map) :
47 m_cve_bsc_map(std::move(cve_bsc_map)),
48 m_bsc_cve_map(std::move(bsc_cve_map)) {}
49
50 Map m_cve_bsc_map;
51 Map m_bsc_cve_map;
52};
53
54}
std::string get_cve(std::string_view bsc_number) const
Get CVE number for a bugzilla.
std::string get_bsc(std::string_view cve_number) const
Get bugzilla number for a CVE.
std::unordered_map< std::string, std::string, SlHelpers::String::Hash, SlHelpers::String::Eq > Map
CVE -> Bugzilla mapping.
Definition CVE2Bugzilla.h:20
static std::optional< CVE2Bugzilla > create(const std::filesystem::path &cve2bugzilla) noexcept
Create a new CVE2Bugzilla map from cve2bugzilla.
Equality test for string and string_view to be used in containers.
Definition String.h:250
Hash for string and string_view to be used in hashing containers.
Definition String.h:223