Бібліотечна система
Бібліотечна система для управління книгами
Завантаження...
Пошук...
Нічого не знайдено
AbstractCollection.hpp
Див. документацію.
1// SPDX-License-Identifier: Proprietary
2// Copyright © 2025 Oleksandr Dreval. All rights reserved.
3
9#ifndef ABSTRACT_COLLECTION_HPP
10#define ABSTRACT_COLLECTION_HPP
11
12#include <nlohmann/json.hpp>
13#include <string>
14
31private:
32 // clang-format off
33 std::string m_id;
34 std::string m_name;
35 // clang-format on
36
37public:
43 AbstractCollection(std::string_view id, std::string_view name) : m_id(id), m_name(name) {}
44
49 virtual ~AbstractCollection() = default;
50
55 std::string getId() const noexcept { return m_id; }
56
61 std::string getName() const noexcept { return m_name; }
62
67 virtual void setId(std::string_view newId) noexcept { m_id = newId; }
68
73 void setName(std::string_view newName) noexcept { m_name = newName; }
74
81 virtual void display() const = 0;
82
88 virtual double calculateStat() const = 0;
89
96 virtual bool search(const std::string& keyword) const = 0;
97};
98
99#endif // ABSTRACT_COLLECTION_HPP
Абстрактний базовий клас, що визначає інтерфейс для роботи з колекціями
Definition AbstractCollection.hpp:30
std::string getName() const noexcept
Отримує назву колекції
Definition AbstractCollection.hpp:61
void setName(std::string_view newName) noexcept
Встановлює нову назву колекції
Definition AbstractCollection.hpp:73
virtual ~AbstractCollection()=default
Віртуальний деструктор
virtual void setId(std::string_view newId) noexcept
Встановлює новий ідентифікатор колекції
Definition AbstractCollection.hpp:67
virtual double calculateStat() const =0
Обчислює статистичні показники колекції
virtual void display() const =0
Відображає повну інформацію про колекцію
std::string getId() const noexcept
Отримує унікальний ідентифікатор колекції
Definition AbstractCollection.hpp:55
AbstractCollection(std::string_view id, std::string_view name)
Конструктор з параметрами
Definition AbstractCollection.hpp:43
virtual bool search(const std::string &keyword) const =0
Виконує пошук у колекції за ключовим словом