mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Introduce LibraryPtr and ConstLibraryPtr.
As we enforce the use of Library through a shared_ptr, let's simplify user life (and code) with new "type".
This commit is contained in:
@ -183,6 +183,9 @@ class ConcurrentCache;
|
||||
template<typename, typename>
|
||||
class MultiKeyCache;
|
||||
|
||||
using LibraryPtr = std::shared_ptr<Library>;
|
||||
using ConstLibraryPtr = std::shared_ptr<const Library>;
|
||||
|
||||
/**
|
||||
* A Library store several books.
|
||||
*/
|
||||
@ -198,8 +201,8 @@ class Library: public std::enable_shared_from_this<Library>
|
||||
Library();
|
||||
|
||||
public:
|
||||
[[nodiscard]] static std::shared_ptr<Library> create() {
|
||||
return std::shared_ptr<Library>(new Library());
|
||||
[[nodiscard]] static LibraryPtr create() {
|
||||
return LibraryPtr(new Library());
|
||||
}
|
||||
~Library();
|
||||
|
||||
@ -405,6 +408,7 @@ private: //data
|
||||
std::unique_ptr<Xapian::WritableDatabase> m_bookDB;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user