clang-tidy: add more nodiscard

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 3 years ago
parent b72e4b0e44
commit 9f67620503

@ -123,7 +123,7 @@ class Position {
virtual ~Position() = default;
// instance methods
bool good() const {
[[nodiscard]] bool good() const {
return time_ || lon_ || lat_ || ele_;
}
std::string getTimeString() {
@ -131,22 +131,22 @@ class Position {
times_ = getExifTime(time_);
return times_;
}
time_t getTime() const {
[[nodiscard]] time_t getTime() const {
return time_;
}
std::string toString() const;
[[nodiscard]] std::string toString() const;
// getters/setters
double lat() const {
[[nodiscard]] double lat() const {
return lat_;
}
double lon() const {
[[nodiscard]] double lon() const {
return lon_;
}
double ele() const {
[[nodiscard]] double ele() const {
return ele_;
}
int delta() const {
[[nodiscard]] int delta() const {
return delta_;
}
void delta(int delta) {

@ -619,19 +619,19 @@ class EXIV2API BlockMap {
size_ = num;
}
bool isNone() const {
[[nodiscard]] bool isNone() const {
return type_ == bNone;
}
bool isKnown() const {
[[nodiscard]] bool isKnown() const {
return type_ == bKnown;
}
byte* getData() const {
[[nodiscard]] byte* getData() const {
return data_;
}
size_t getSize() const {
[[nodiscard]] size_t getSize() const {
return size_;
}

@ -262,7 +262,7 @@ class Converter {
//! @name Accessors
//@{
//! Get the value of the erase flag, see also setErase(bool on).
bool erase() const {
[[nodiscard]] bool erase() const {
return erase_;
}
//@}

@ -76,17 +76,17 @@ class Thumbnail {
@brief Return the thumbnail image in a %DataBuf. The caller owns the
data buffer and %DataBuf ensures that it will be deleted.
*/
virtual Exiv2::DataBuf copy(const Exiv2::ExifData& exifData) const = 0;
[[nodiscard]] virtual Exiv2::DataBuf copy(const Exiv2::ExifData& exifData) const = 0;
/*!
@brief Return the MIME type of the thumbnail ("image/tiff" or
"image/jpeg").
*/
virtual const char* mimeType() const = 0;
[[nodiscard]] virtual const char* mimeType() const = 0;
/*!
@brief Return the file extension for the format of the thumbnail
(".tif", ".jpg").
*/
virtual const char* extension() const = 0;
[[nodiscard]] virtual const char* extension() const = 0;
//@}
}; // class Thumbnail
@ -100,9 +100,9 @@ class TiffThumbnail : public Thumbnail {
//! @name Accessors
//@{
Exiv2::DataBuf copy(const Exiv2::ExifData& exifData) const override;
const char* mimeType() const override;
const char* extension() const override;
[[nodiscard]] Exiv2::DataBuf copy(const Exiv2::ExifData& exifData) const override;
[[nodiscard]] const char* mimeType() const override;
[[nodiscard]] const char* extension() const override;
//@}
}; // class TiffThumbnail
@ -116,9 +116,9 @@ class JpegThumbnail : public Thumbnail {
//! @name Accessors
//@{
Exiv2::DataBuf copy(const Exiv2::ExifData& exifData) const override;
const char* mimeType() const override;
const char* extension() const override;
[[nodiscard]] Exiv2::DataBuf copy(const Exiv2::ExifData& exifData) const override;
[[nodiscard]] const char* mimeType() const override;
[[nodiscard]] const char* extension() const override;
//@}
}; // class JpegThumbnail

@ -58,15 +58,15 @@ class Loader {
static UniquePtr create(PreviewId id, const Image& image);
//! Check if a preview image with given params exists in the image
virtual bool valid() const {
[[nodiscard]] virtual bool valid() const {
return valid_;
}
//! Get properties of a preview image with given params
virtual PreviewProperties getProperties() const;
[[nodiscard]] virtual PreviewProperties getProperties() const;
//! Get a buffer that contains the preview image
virtual DataBuf getData() const = 0;
[[nodiscard]] virtual DataBuf getData() const = 0;
//! Read preview image dimensions when they are not available directly
virtual bool readDimensions() {
@ -119,10 +119,10 @@ class LoaderNative : public Loader {
LoaderNative(PreviewId id, const Image& image, int parIdx);
//! Get properties of a preview image with given params
PreviewProperties getProperties() const override;
[[nodiscard]] PreviewProperties getProperties() const override;
//! Get a buffer that contains the preview image
DataBuf getData() const override;
[[nodiscard]] DataBuf getData() const override;
//! Read preview image dimensions
bool readDimensions() override;
@ -142,10 +142,10 @@ class LoaderExifJpeg : public Loader {
LoaderExifJpeg(PreviewId id, const Image& image, int parIdx);
//! Get properties of a preview image with given params
PreviewProperties getProperties() const override;
[[nodiscard]] PreviewProperties getProperties() const override;
//! Get a buffer that contains the preview image
DataBuf getData() const override;
[[nodiscard]] DataBuf getData() const override;
//! Read preview image dimensions
bool readDimensions() override;
@ -175,10 +175,10 @@ class LoaderExifDataJpeg : public Loader {
LoaderExifDataJpeg(PreviewId id, const Image& image, int parIdx);
//! Get properties of a preview image with given params
PreviewProperties getProperties() const override;
[[nodiscard]] PreviewProperties getProperties() const override;
//! Get a buffer that contains the preview image
DataBuf getData() const override;
[[nodiscard]] DataBuf getData() const override;
//! Read preview image dimensions
bool readDimensions() override;
@ -207,10 +207,10 @@ class LoaderTiff : public Loader {
LoaderTiff(PreviewId id, const Image& image, int parIdx);
//! Get properties of a preview image with given params
PreviewProperties getProperties() const override;
[[nodiscard]] PreviewProperties getProperties() const override;
//! Get a buffer that contains the preview image
DataBuf getData() const override;
[[nodiscard]] DataBuf getData() const override;
protected:
//! Name of the group that contains the preview image
@ -243,10 +243,10 @@ class LoaderXmpJpeg : public Loader {
LoaderXmpJpeg(PreviewId id, const Image& image, int parIdx);
//! Get properties of a preview image with given params
PreviewProperties getProperties() const override;
[[nodiscard]] PreviewProperties getProperties() const override;
//! Get a buffer that contains the preview image
DataBuf getData() const override;
[[nodiscard]] DataBuf getData() const override;
//! Read preview image dimensions
bool readDimensions() override;

@ -168,7 +168,7 @@ struct ExifKey::Impl {
//! @name Accessors
//@{
//! Return the name of the tag
std::string tagName() const;
[[nodiscard]] std::string tagName() const;
//@}
// DATA

Loading…
Cancel
Save