Deprecate Entry creation.

As the `Entry` is still created by `Reader` we need a way to create a
entry without raising a deprecated warning.
To do so we create a second constructor with a dummy argument.
This second constructor is private and is not marked as deprecated so we
can use it.
This commit is contained in:
Matthieu Gautier
2022-01-12 18:10:28 +01:00
parent 39732e2bcf
commit 96e0d15ab4
3 changed files with 18 additions and 8 deletions

View File

@ -47,7 +47,7 @@ class Entry
*
* @param article a zim::Article object
*/
Entry(zim::Entry entry);
DEPRECATED Entry(zim::Entry entry) : Entry(entry, true) {};
virtual ~Entry() = default;
/**
@ -176,6 +176,16 @@ class Entry
private:
zim::Entry entry;
private:
// Entry is deprecated, so we've marked the constructor as deprecated.
// But we still need to construct the entry (in our deprecated code)
// To avoid warning because we use deprecated function, we create a second
// constructor not deprecated. The `bool marker` is unused, it sole purpose
// is to change the signature to have two different constructor.
// This one is not deprecated and we must use it in our private code.
Entry(zim::Entry entry, bool marker);
friend class Reader;
};
}