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

clang-tidy with headers #2200

Merged
merged 9 commits into from
Apr 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/exiv2/basicio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,9 @@ class EXIV2API XPathIo : public FileIo {
~XPathIo() override;
//@}

XPathIo(const XPathIo&) = delete;
XPathIo& operator=(const XPathIo&) = delete;

//! @name Manipulators
//@{
/*!
Expand Down Expand Up @@ -751,6 +754,9 @@ class EXIV2API RemoteIo : public BasicIo {
~RemoteIo() override;
//@}

RemoteIo(const RemoteIo&) = delete;
RemoteIo& operator=(const RemoteIo&) = delete;

//! @name Manipulators
//@{
/*!
Expand Down Expand Up @@ -920,6 +926,7 @@ class EXIV2API HttpIo : public RemoteIo {
*/
explicit HttpIo(const std::string& url, size_t blockSize = 1024);

~HttpIo() override = default;
// NOT IMPLEMENTED
//! Copy constructor
HttpIo(const HttpIo&) = delete;
Expand Down Expand Up @@ -964,6 +971,7 @@ class EXIV2API CurlIo : public RemoteIo {
*/
size_t write(BasicIo& src) override;

~CurlIo() override = default;
// NOT IMPLEMENTED
//! Copy constructor
CurlIo(const CurlIo&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion include/exiv2/bmffimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class EXIV2API BmffImage : public Image {
@warning This function should only be called by readMetadata()
*/
long boxHandler(std::ostream& out, Exiv2::PrintStructureOption option, const long pbox_end, int depth);
[[nodiscard]] std::string indent(int i) const {
[[nodiscard]] static std::string indent(int i) {
return std::string(2 * i, ' ');
}

Expand Down
1 change: 1 addition & 0 deletions include/exiv2/bmpimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace Exiv2 {
*/
class EXIV2API BmpImage : public Image {
public:
~BmpImage() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/cr2image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class EXIV2API Cr2Image : public Image {
[[nodiscard]] uint32_t pixelHeight() const override;
//@}

~Cr2Image() override = default;
//! @name NOT implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/crwimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class EXIV2API CrwImage : public Image {
[[nodiscard]] uint32_t pixelHeight() const override;
//@}

~CrwImage() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
3 changes: 2 additions & 1 deletion include/exiv2/datasets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class EXIV2API IptcDataSets {
static constexpr uint16_t Preview = 202;
//@}

~IptcDataSets() = delete;
//! Prevent copy-construction: not implemented.
IptcDataSets(const IptcDataSets&) = delete;
//! Prevent assignment: not implemented.
Expand Down Expand Up @@ -263,7 +264,7 @@ class EXIV2API IptcKey : public Key {
IptcKey(uint16_t tag, uint16_t record);
//! Copy constructor
IptcKey(const IptcKey& rhs);
IptcKey& operator=(const IptcKey&) = delete;
IptcKey& operator=(const IptcKey&) = default;
//! Destructor
~IptcKey() override = default;
//@}
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/epsimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class EXIV2API EpsImage : public Image {
[[nodiscard]] std::string mimeType() const override;
//@}

~EpsImage() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/gifimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Exiv2 {
*/
class EXIV2API GifImage : public Image {
public:
~GifImage() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ class EXIV2API ImageFactory {

//! @name Creators
//@{
~ImageFactory() = delete;
//! Prevent copy construction: not implemented.
ImageFactory(const ImageFactory&) = delete;
ImageFactory& operator=(const ImageFactory&) = delete;
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/jp2image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class EXIV2API Jp2Image : public Image {
[[nodiscard]] std::string mimeType() const override;
//@}

~Jp2Image() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
3 changes: 3 additions & 0 deletions include/exiv2/jpgimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class EXIV2API JpegBase : public Image {
void printStructure(std::ostream& out, PrintStructureOption option, int depth) override;
//@}

~JpegBase() override = default;
//! @name NOT implemented
//@{
//! Copy constructor
Expand Down Expand Up @@ -264,6 +265,7 @@ class EXIV2API JpegImage : public JpegBase {
[[nodiscard]] std::string mimeType() const override;
//@}

~JpegImage() override = default;
// NOT Implemented
//! Copy constructor
JpegImage(const JpegImage&) = delete;
Expand Down Expand Up @@ -323,6 +325,7 @@ class EXIV2API ExvImage : public JpegBase {
[[nodiscard]] std::string mimeType() const override;
//@}

~ExvImage() override = default;
// NOT Implemented
//! Copy constructor
ExvImage(const ExvImage&) = delete;
Expand Down
3 changes: 2 additions & 1 deletion include/exiv2/metadatum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ class EXIV2API Key {

//! @name Creators
//@{
Key() = default;
//! Destructor
virtual ~Key() = default;
//@}

Key(const Key&) = default;
//! @name Accessors
//@{
/*!
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/mrwimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Exiv2 {
*/
class EXIV2API MrwImage : public Image {
public:
~MrwImage() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/orfimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Exiv2 {
*/
class EXIV2API OrfImage : public TiffImage {
public:
~OrfImage() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/pgfimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class EXIV2API PgfImage : public Image {
}
//@}

~PgfImage() override = default;
//! @name NOT implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/pngimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class EXIV2API PngImage : public Image {
[[nodiscard]] std::string mimeType() const override;
//@}

~PngImage() override = default;
//! @name NOT implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class EXIV2API XmpProperties {
static const XmpNsInfo* lookupNsRegistryUnsafe(const XmpNsInfo::Prefix& prefix);

public:
~XmpProperties() = delete;
//! Prevent copy-construction: not implemented.
XmpProperties(const XmpProperties&) = delete;
//! Prevent assignment: not implemented.
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/psdimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Exiv2 {
*/
class EXIV2API PsdImage : public Image {
public:
~PsdImage() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/rafimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class EXIV2API RafImage : public Image {
[[nodiscard]] uint32_t pixelHeight() const override;
//@}

~RafImage() override = default;
//! @name NOT implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/rw2image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class EXIV2API Rw2Image : public Image {
[[nodiscard]] uint32_t pixelHeight() const override;
//@}

~Rw2Image() override = default;
//! @name NOT implemented
//@{
//! Copy constructor
Expand Down
34 changes: 17 additions & 17 deletions include/exiv2/slice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ struct ConstSliceBase : SliceBase {
/*!
* Obtain a constant iterator to the first element in the slice.
*/
const_iterator cbegin() const noexcept {
[[nodiscard]] const_iterator cbegin() const noexcept {
return storage_.unsafeGetIteratorAt(begin_);
}

/*!
* Obtain a constant iterator to the first beyond the slice.
*/
const_iterator cend() const noexcept {
[[nodiscard]] const_iterator cend() const noexcept {
return storage_.unsafeGetIteratorAt(end_);
}

Expand All @@ -129,7 +129,7 @@ struct ConstSliceBase : SliceBase {
* mutable_slice_base.
*/
template <typename slice_type>
slice_type subSlice(size_t begin, size_t end) const {
[[nodiscard]] slice_type subSlice(size_t begin, size_t end) const {
this->rangeCheck(begin);
// end == size() is a legal value, since end is the first
// element beyond the slice
Expand Down Expand Up @@ -219,8 +219,8 @@ struct MutableSliceBase : public ConstSliceBase<storage_type, data_type> {
* the appropriate `slice<const T>` and call its `subSlice() const`,
* which returns the correct type.
*/
ConstSliceBase<storage_type, const data_type> to_const_base() const noexcept {
return ConstSliceBase<storage_type, const data_type>(this->storage_.data_, this->begin_, this->end_);
[[nodiscard]] ConstSliceBase<storage_type, const data_type> to_const_base() const noexcept {
return {this->storage_.data_, this->begin_, this->end_};
}

using base_type = ConstSliceBase<storage_type, data_type>;
Expand Down Expand Up @@ -281,11 +281,11 @@ struct ContainerStorage {
*
* @throw whatever container::at() throws
*/
const value_type& unsafeAt(size_t index) const {
[[nodiscard]] const value_type& unsafeAt(size_t index) const {
return data_.at(index);
}

value_type& unsafeAt(size_t index) {
[[nodiscard]] value_type& unsafeAt(size_t index) {
return data_.at(index);
}

Expand All @@ -295,19 +295,19 @@ struct ContainerStorage {
*
* @throw whatever container::begin() and std::advance() throw
*/
iterator unsafeGetIteratorAt(size_t index) {
[[nodiscard]] iterator unsafeGetIteratorAt(size_t index) {
// we are screwed if the container got changed => try to catch it
assert(index <= data_.size());

iterator it = data_.begin();
auto it = data_.begin();
std::advance(it, index);
return it;
}

const_iterator unsafeGetIteratorAt(size_t index) const {
[[nodiscard]] const_iterator unsafeGetIteratorAt(size_t index) const {
assert(index <= data_.size());

const_iterator it = data_.begin();
auto it = data_.begin();
std::advance(it, index);
return it;
}
Expand Down Expand Up @@ -346,11 +346,11 @@ struct PtrSliceStorage {
*
* @throw nothing
*/
value_type& unsafeAt(size_t index) noexcept {
[[nodiscard]] value_type& unsafeAt(size_t index) noexcept {
return data_[index];
}

const value_type& unsafeAt(size_t index) const noexcept {
[[nodiscard]] const value_type& unsafeAt(size_t index) const noexcept {
return data_[index];
}

Expand All @@ -360,11 +360,11 @@ struct PtrSliceStorage {
*
* @throw nothing
*/
iterator unsafeGetIteratorAt(size_t index) noexcept {
[[nodiscard]] iterator unsafeGetIteratorAt(size_t index) noexcept {
return data_ + index;
}

const_iterator unsafeGetIteratorAt(size_t index) const noexcept {
[[nodiscard]] const_iterator unsafeGetIteratorAt(size_t index) const noexcept {
return data_ + index;
}

Expand Down Expand Up @@ -462,7 +462,7 @@ struct Slice : public Internal::MutableSliceBase<Internal::ContainerStorage, con
* Constructs a new constant subSlice. Behaves otherwise exactly like
* the non-const version.
*/
Slice<const container> subSlice(size_t begin, size_t end) const {
[[nodiscard]] Slice<const container> subSlice(size_t begin, size_t end) const {
return this->to_const_base().template subSlice<Slice<const container>>(begin, end);
}
};
Expand Down Expand Up @@ -534,7 +534,7 @@ struct Slice<T*> : public Internal::MutableSliceBase<Internal::PtrSliceStorage,
return Internal::MutableSliceBase<Internal::PtrSliceStorage, T*>::template subSlice<Slice<T*>>(begin, end);
}

Slice<const T*> subSlice(size_t begin, size_t end) const {
[[nodiscard]] Slice<const T*> subSlice(size_t begin, size_t end) const {
return this->to_const_base().template subSlice<Slice<const T*>>(begin, end);
}
};
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/tags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct EXIV2API TagInfo {
//! Access to Exif group and tag lists and misc. tag reference methods, implemented as a static class.
class EXIV2API ExifTags {
public:
~ExifTags() = delete;
//! Prevent copy-construction: not implemented.
ExifTags(const ExifTags&) = delete;
//! Prevent assignment: not implemented.
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/tgaimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Exiv2 {
*/
class EXIV2API TgaImage : public Image {
public:
~TgaImage() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/tiffimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class EXIV2API TiffImage : public Image {
uint32_t pixelHeight() const override;
//@}

~TiffImage() override = default;
//! @name NOT Implemented
//@{
//! Copy constructor
Expand Down
1 change: 1 addition & 0 deletions include/exiv2/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class EXIV2API TypeInfo {
TypeInfo(const TypeInfo&) = delete;
//! Prevent assignment: not implemented.
TypeInfo& operator=(const TypeInfo&) = delete;
~TypeInfo() = delete;

//! Return the name of the type, 0 if unknown.
static const char* typeName(TypeId typeId);
Expand Down
5 changes: 3 additions & 2 deletions include/exiv2/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class EXIV2API Value {
//@{
//! Constructor, taking a type id to initialize the base class with
explicit Value(TypeId typeId);
Value(const Value&) = default;
//! Virtual destructor.
virtual ~Value() = default;
//@}
Expand Down Expand Up @@ -489,6 +490,7 @@ class EXIV2API CommentValue : public StringValueBase {
CharsetInfo(const CharsetInfo&) = delete;
//! Prevent assignment: not implemented.
CharsetInfo& operator=(const CharsetInfo&) = delete;
~CharsetInfo() = delete;

//! Return the name for a charset id
static const char* name(CharsetId charsetId);
Expand Down Expand Up @@ -1251,9 +1253,8 @@ class ValueType : public Value {
if (static_cast<decltype(v)>(std::numeric_limits<I>::min()) <= v &&
v <= static_cast<decltype(v)>(std::numeric_limits<I>::max())) {
return static_cast<I>(std::round(v));
} else {
return 0;
}
return 0;
}

//! Utility for toInt64, toUint32, etc.
Expand Down
Loading