Skip to content

Commit

Permalink
Fix code formatting and clang-tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rikyoz committed Aug 19, 2024
1 parent 4b86c2c commit d3ae788
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 20 deletions.
28 changes: 21 additions & 7 deletions include/bit7z/bitgenericitem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,38 @@ class BitGenericItem {
/**
* @return true if and only if the item is a directory (i.e., it has the property BitProperty::IsDir).
*/
BIT7Z_NODISCARD virtual auto isDir() const -> bool = 0;
BIT7Z_NODISCARD
virtual auto isDir() const -> bool = 0;

/**
* @return true if and only if the item is a symbolic link.
*/
BIT7Z_NODISCARD virtual auto isSymLink() const -> bool = 0;
BIT7Z_NODISCARD
virtual auto isSymLink() const -> bool = 0;

/**
* @return the uncompressed size of the item.
*/
BIT7Z_NODISCARD virtual auto size() const -> uint64_t = 0;
BIT7Z_NODISCARD
virtual auto size() const -> uint64_t = 0;

/**
* @return the name of the item, if available or inferable from the path, or an empty string otherwise.
*/
BIT7Z_NODISCARD virtual auto name() const -> tstring = 0;
BIT7Z_NODISCARD
virtual auto name() const -> tstring = 0;

/**
* @return the path of the item.
*/
BIT7Z_NODISCARD virtual auto path() const -> tstring = 0;
BIT7Z_NODISCARD
virtual auto path() const -> tstring = 0;

/**
* @return the item attributes.
*/
BIT7Z_NODISCARD virtual auto attributes() const -> uint32_t = 0;
BIT7Z_NODISCARD
virtual auto attributes() const -> uint32_t = 0;

/**
* @brief Gets the specified item property.
Expand All @@ -60,9 +66,17 @@ class BitGenericItem {
*
* @return the value of the item property, if available, or an empty BitPropVariant.
*/
BIT7Z_NODISCARD virtual auto itemProperty( BitProperty property ) const -> BitPropVariant = 0;
BIT7Z_NODISCARD
virtual auto itemProperty( BitProperty property ) const -> BitPropVariant = 0;

virtual ~BitGenericItem() = default;

protected:
BitGenericItem() = default;
BitGenericItem( const BitGenericItem& ) = default;
BitGenericItem( BitGenericItem&& ) noexcept = default;
auto operator=( const BitGenericItem& ) -> BitGenericItem& = default;
auto operator=( BitGenericItem&& ) noexcept -> BitGenericItem& = default;
};

} // namespace bit7z
Expand Down
4 changes: 2 additions & 2 deletions src/bitarchiveitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ auto BitArchiveItem::crc() const -> uint32_t {
// On MSVC, these macros are not defined, so we define them here.
#if !defined(S_ISLNK)
#ifndef S_IFLNK
constexpr auto S_IFLNK = 0xA000;
constexpr auto S_IFLNK = 0xA000;
#endif
#ifndef S_IFMT
constexpr auto S_IFMT = 0xF000;
constexpr auto S_IFMT = 0xF000;
#endif
#define S_ISLNK( m ) (((m) & S_IFMT) == S_IFLNK)
#endif
Expand Down
39 changes: 28 additions & 11 deletions src/internal/genericinputitem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,44 @@ struct ISequentialInStream;
namespace bit7z {

struct GenericInputItem : public BitGenericItem {
BIT7Z_NODISCARD virtual auto inArchivePath() const -> fs::path = 0;
BIT7Z_NODISCARD
virtual auto inArchivePath() const -> fs::path = 0;

BIT7Z_NODISCARD virtual auto getStream( ISequentialInStream** inStream ) const -> HRESULT = 0;
BIT7Z_NODISCARD
virtual auto getStream( ISequentialInStream** inStream ) const -> HRESULT = 0;

BIT7Z_NODISCARD virtual auto creationTime() const -> FILETIME = 0;
BIT7Z_NODISCARD
virtual auto creationTime() const -> FILETIME = 0;

BIT7Z_NODISCARD virtual auto lastAccessTime() const -> FILETIME = 0;
BIT7Z_NODISCARD
virtual auto lastAccessTime() const -> FILETIME = 0;

BIT7Z_NODISCARD virtual auto lastWriteTime() const -> FILETIME = 0;
BIT7Z_NODISCARD
virtual auto lastWriteTime() const -> FILETIME = 0;

BIT7Z_NODISCARD virtual auto filesystemPath() const -> const fs::path& = 0;
BIT7Z_NODISCARD
virtual auto filesystemPath() const -> const fs::path& = 0;

BIT7Z_NODISCARD virtual auto filesystemName() const -> fs::path = 0;
BIT7Z_NODISCARD
virtual auto filesystemName() const -> fs::path = 0;

BIT7Z_NODISCARD virtual auto hasNewData() const noexcept -> bool;
BIT7Z_NODISCARD
virtual auto hasNewData() const noexcept -> bool;

BIT7Z_NODISCARD auto isSymLink() const -> bool override;
BIT7Z_NODISCARD
auto isSymLink() const -> bool override;

BIT7Z_NODISCARD auto itemProperty( BitProperty property ) const -> BitPropVariant override;
BIT7Z_NODISCARD
auto itemProperty( BitProperty property ) const -> BitPropVariant override;

~GenericInputItem() override = default;
~GenericInputItem() override = default;

protected:
GenericInputItem() = default;
GenericInputItem( const GenericInputItem& ) = default;
GenericInputItem( GenericInputItem&& ) noexcept = default;
auto operator=( const GenericInputItem& ) -> GenericInputItem& = default;
auto operator=( GenericInputItem&& ) noexcept -> GenericInputItem& = default;
};

} // namespace bit7z
Expand Down

0 comments on commit d3ae788

Please sign in to comment.