<commit_before>#ifndef NOTEBOOK_H
#define NOTEBOOK_H
#include "widgetList.h"
#include "note.h"
#include <QFile>
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
#include "memory"
#include "settings.h"

class Notebook
{
public:
    Notebook(const std::weak_ptr<Settings>);
    ~Notebook();
    void loadNotes();
    void saveNotes() const;
    void addNote(Note *n);
    void addNote(const QDate date, const QString text, const nFrequency frequency,
                 const bool notifEnabled, const int daysPrior);
    bool deleteNote(Note *n);
    int deleteOutdated(const QDate&);
    int deleteAll();
    std::unique_ptr<QList<Note*>> getNotesFromDate(const QDate&) const;
    std::unique_ptr<QList<Note*>> getNotificationsFromDate(const QDate&) const;
    Note* findClosest(const QDate&) const;
    int contains (const QDate&) const;
    void sort();

private:
    const QString filePath = QApplication::applicationDirPath() + "/OrgNotes.xml";
    bool noteOnDate(Note* const, const QDate&) const;
    bool notificationOnDate(Note* const note, const QDate&date) const;
    QDate closestDate(Note* const note, const QDate&date) const;
    QList<Note*> notes;
    std::shared_ptr<Settings> settings;
    Note* parseNote(QXmlStreamReader&) const;

    struct ptrLess
    {
        bool operator()(const Note *a, const Note *b)
        {
            if(a != nullptr && b != nullptr)
            {
                return *a < *b;
            }
            else
            {
                throw std::runtime_error("Null pointer passed as an argument");
            }
        }
    };
};

#endif // NOTEBOOK_H
<commit_msg>show all notes window is now a friend<commit_after>#ifndef NOTEBOOK_H
#define NOTEBOOK_H
#include "widgetList.h"
#include "note.h"
#include <QFile>
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
#include "memory"
#include "settings.h"

class Notebook
{
    friend class NoteListWindow;
public:
    Notebook(const std::weak_ptr<Settings>);
    ~Notebook();
    void loadNotes();
    void saveNotes() const;
    void addNote(Note *n);
    void addNote(const QDate date, const QString text, const nFrequency frequency,
                 const bool notifEnabled, const int daysPrior);
    bool deleteNote(Note *n);
    int deleteOutdated(const QDate&);
    int deleteAll();
    std::unique_ptr<QList<Note*>> getNotesFromDate(const QDate&) const;
    std::unique_ptr<QList<Note*>> getNotificationsFromDate(const QDate&) const;
    Note* findClosest(const QDate&) const;
    int contains (const QDate&) const;
    void sort();

private:
    const QString filePath = QApplication::applicationDirPath() + "/OrgNotes.xml";
    bool noteOnDate(Note* const, const QDate&) const;
    bool notificationOnDate(Note* const note, const QDate&date) const;
    QDate closestDate(Note* const note, const QDate&date) const;
    QList<Note*> notes;
    std::shared_ptr<Settings> settings;
    Note* parseNote(QXmlStreamReader&) const;

    struct ptrLess
    {
        bool operator()(const Note *a, const Note *b)
        {
            if(a != nullptr && b != nullptr)
            {
                return *a < *b;
            }
            else
            {
                throw std::runtime_error("Null pointer passed as an argument");
            }
        }
    };
};

#endif // NOTEBOOK_H

{'fraction_non_alphanumeric': 0.11386288130474177, 'fraction_numerical': 0.0, 'mean_word_length': 3.0341047503045067, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1614170', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1011, 'n_words': 278}