d1vanov/libquentier

Improve local storage API in findNote and listNotes* methods

Closed this issue · 1 comments

Currently these methods have bool parameters determining whether the found/listed notes should contain resources metadata and/or resources binary data:

    bool findNote(Note & note, ErrorString & errorDescription,                                                              
                  const bool withResourceMetadata = true,                                                                   
                  const bool withResourceBinaryData = true) const;

It's kinda ugly - there's a good explanation why boolean parameters in API are not very good.
I think it should instead be represented somewhat like this:

struct GetNoteOption
{
    enum type
    {
        WithResourceMetadata = 1,
        WithResourceBinaryData = 2
    };
};
Q_DECLARE_FLAGS(GetNoteOptions, GetNoteOption::type)

bool findNote(Note & note, const GetNoteOptions options, ErrorString & errorDescription);

Done in development branch.