Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shouldn't some of the methods of kiwix::Library be const? #487

Closed
veloman-yunkan opened this issue Apr 9, 2021 · 1 comment · Fixed by #499
Closed

Shouldn't some of the methods of kiwix::Library be const? #487

veloman-yunkan opened this issue Apr 9, 2021 · 1 comment · Fixed by #499
Assignees
Milestone

Comments

@veloman-yunkan
Copy link
Collaborator

The following public methods of kiwix::Library are conceptually const but are not declared such:

  std::shared_ptr<Reader> getReaderById(const std::string& id);
  bool writeToFile(const std::string& path);
  bool writeBookmarksToFile(const std::string& path);
  unsigned int getBookCount(const bool localBooks, const bool remoteBooks);
  std::vector<std::string> getBooksLanguages();
  std::vector<std::string> getBooksCreators();
  std::vector<std::string> getBooksPublishers();
  const std::vector<kiwix::Bookmark> getBookmarks(bool onlyValidBookmarks = true);
  BookIdCollection getBooksIds();
  DEPRECATED BookIdCollection filter(const std::string& search);
  BookIdCollection filter(const Filter& filter);
  void sort(BookIdCollection& bookIds, supportedListSortBy sortBy, bool ascending);
  DEPRECATED BookIdCollection listBooksIds(...);

Besides, it makes sense to have const versions of the following methods:

  Book& getBookById(const std::string& id);
  Book& getBookByPath(const std::string& path);

Is there anything that is preventing us from doing this?

@mgautierfr
Copy link
Member

mgautierfr commented Apr 12, 2021

Is there anything that is preventing us from doing this?

No.
Potentially API/ABI compatibility, but we can bump the version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants