|
Lab1
|
Центральний репозиторій для керування даними (Repository Pattern). More...
#include <note_repository.h>
Public Member Functions | |
| NoteRepository (std::unique_ptr< IStorageStrategy > strategy) | |
| Конструктор. Приймає стратегію збереження. | |
| void | addSchema (const Schema &schema) |
| const QList< Schema > & | getSchemas () const |
| void | removeSchema (int index) |
| void | updateSchema (int index, const Schema &schema) |
| void | addNote (const Note ¬e) |
| QList< Note > & | getNotes () |
| void | removeNote (int index) |
| void | updateNote (int index, const Note ¬e) |
| void | sortNotes (SortType type) |
| void | addUsageTime (int seconds) |
| QMap< QString, int > | getUsageStats () const |
| bool | save (const QString &filePath) |
| bool | load (const QString &filePath) |
| void | setStrategy (std::unique_ptr< IStorageStrategy > newStrategy) |
| Змінює стратегію збереження "на льоту". | |
Центральний репозиторій для керування даними (Repository Pattern).
Клас відповідає за CRUD операції над нотатками та схемами. Він ізолює логіку збереження, делегуючи її об'єкту IStorageStrategy. Також містить бізнес-логіку експорту та імпорту.
|
explicit |
Конструктор. Приймає стратегію збереження.
| strategy | Унікальний вказівник на конкретну реалізацію збереження. |