Mark everything [[nodiscard]], fix some comments.

This commit is contained in:
tastytea 2021-05-24 13:00:03 +02:00
parent 643c4b0c42
commit b2e70a6faa
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 12 additions and 10 deletions

View File

@ -27,7 +27,7 @@ namespace epubgrep::options
namespace po = boost::program_options;
//! Parse options and return them.
po::variables_map parse_options(int argc, char *argv[]);
[[nodiscard]] po::variables_map parse_options(int argc, char *argv[]);
/*!
* @brief Returns the path of the config file.
@ -36,7 +36,7 @@ po::variables_map parse_options(int argc, char *argv[]);
* If HOME is set: ${HOME}/.config/epubgrep.conf
* Otherwise: epubgrep.conf
*/
fs::path get_config_path();
[[nodiscard]] fs::path get_config_path();
} // namespace epubgrep::options

View File

@ -47,8 +47,9 @@ struct options
std::uint64_t context{0};
};
std::vector<match> search(const fs::path &filepath, std::string_view regex,
const options &opts);
[[nodiscard]] std::vector<match> search(const fs::path &filepath,
std::string_view regex,
const options &opts);
} // namespace epubgrep::search

View File

@ -29,19 +29,20 @@
namespace epubgrep::zip
{
//! List the contents of a zip file.
std::vector<std::string> list(const fs::path &filepath);
//! Return the table of contents of a zip file.
[[nodiscard]] std::vector<std::string> list(const fs::path &filepath);
//! Read a file from a zip archive.
std::string read_file(const fs::path &filepath, std::string_view entry_path);
//! Read a file from a zip archive and return its contents.
[[nodiscard]] std::string read_file(const fs::path &filepath,
std::string_view entry_path);
//! Open zip file and return handle.
struct archive *open_file(const fs::path &filepath);
[[nodiscard]] struct archive *open_file(const fs::path &filepath);
//! Close zip file.
void close_file(struct archive *zipfile, const fs::path &filepath);
// It's std::runtime_error, but with another name.
//! It's std::runtime_error, but with another name.
class exception : public std::runtime_error
{
public: