diff --git a/CMakeLists.txt b/CMakeLists.txt index ba7d548..1f2b4f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,8 @@ set(META_APP_NAME "Tag Parser") set(META_APP_AUTHOR "Martchus") set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}") set(META_APP_DESCRIPTION "C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags") -set(META_VERSION_MAJOR 9) -set(META_VERSION_MINOR 4) +set(META_VERSION_MAJOR 10) +set(META_VERSION_MINOR 0) set(META_VERSION_PATCH 0) set(META_REQUIRED_CPP_UNIT_VERSION 1.14.0) set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON) diff --git a/aspectratio.h b/aspectratio.h index a9bfce0..8b9d7af 100644 --- a/aspectratio.h +++ b/aspectratio.h @@ -11,9 +11,9 @@ namespace TagParser { struct TAG_PARSER_EXPORT AspectRatio { - constexpr AspectRatio(); - AspectRatio(std::uint8_t aspectRatioType); - constexpr AspectRatio(std::uint16_t numerator, std::uint16_t denominator); + constexpr explicit AspectRatio(); + explicit AspectRatio(std::uint8_t aspectRatioType); + constexpr explicit AspectRatio(std::uint16_t numerator, std::uint16_t denominator); constexpr bool isValid() const; constexpr bool isExtended() const; std::string toString() const; diff --git a/basicfileinfo.h b/basicfileinfo.h index ed8dcff..6f69e56 100644 --- a/basicfileinfo.h +++ b/basicfileinfo.h @@ -14,7 +14,7 @@ namespace TagParser { class TAG_PARSER_EXPORT BasicFileInfo { public: // constructor, destructor - BasicFileInfo(const std::string &path = std::string()); + explicit BasicFileInfo(const std::string &path = std::string()); BasicFileInfo(const BasicFileInfo &) = delete; BasicFileInfo &operator=(const BasicFileInfo &) = delete; virtual ~BasicFileInfo(); diff --git a/id3/id3v1tag.cpp b/id3/id3v1tag.cpp index 6344038..3111764 100644 --- a/id3/id3v1tag.cpp +++ b/id3/id3v1tag.cpp @@ -237,8 +237,8 @@ void Id3v1Tag::removeAllFields() unsigned int Id3v1Tag::fieldCount() const { unsigned int count = 0; - for (const auto &value : { m_title, m_artist, m_album, m_year, m_comment, m_trackPos, m_genre }) { - if (!value.isEmpty()) { + for (const auto &value : std::initializer_list{ &m_title, &m_artist, &m_album, &m_year, &m_comment, &m_trackPos, &m_genre }) { + if (!value->isEmpty()) { ++count; } } diff --git a/id3/id3v2tag.cpp b/id3/id3v2tag.cpp index 8577d64..a8c57ae 100644 --- a/id3/id3v2tag.cpp +++ b/id3/id3v2tag.cpp @@ -404,11 +404,11 @@ void Id3v2Tag::convertOldRecordDateFields(const std::string &diagContext, Diagno // set the field values as DateTime try { - setValue(Id3v2FrameIds::lRecordingTime, DateTime::fromDateAndTime(year, month, day, hour, minute)); + setValue(Id3v2FrameIds::lRecordingTime, TagValue(DateTime::fromDateAndTime(year, month, day, hour, minute))); } catch (const ConversionException &e) { try { // try to set at least the year - setValue(Id3v2FrameIds::lRecordingTime, DateTime::fromDate(year)); + setValue(Id3v2FrameIds::lRecordingTime, TagValue(DateTime::fromDate(year))); diag.emplace_back(DiagLevel::Critical, argsToString( "Unable to parse the full date of the recording. Only the 'Year' frame could be parsed; related frames failed: ", e.what()), diff --git a/localeawarestring.h b/localeawarestring.h index 650c4bb..3f23f0d 100644 --- a/localeawarestring.h +++ b/localeawarestring.h @@ -13,8 +13,8 @@ namespace TagParser { */ class TAG_PARSER_EXPORT LocaleAwareString : public std::string { public: - LocaleAwareString(const std::string &value = std::string()); - LocaleAwareString(std::string &&value); + explicit LocaleAwareString(const std::string &value = std::string()); + explicit LocaleAwareString(std::string &&value); ~LocaleAwareString(); const std::vector &languages() const; diff --git a/margin.h b/margin.h index edbbad6..092e790 100644 --- a/margin.h +++ b/margin.h @@ -15,7 +15,7 @@ namespace TagParser { */ class TAG_PARSER_EXPORT Margin { public: - constexpr Margin(std::uint32_t top = 0, std::uint32_t left = 0, std::uint32_t bottom = 0, std::uint32_t right = 0); + constexpr explicit Margin(std::uint32_t top = 0, std::uint32_t left = 0, std::uint32_t bottom = 0, std::uint32_t right = 0); constexpr std::uint32_t top() const; void setTop(std::uint32_t top); constexpr std::uint32_t left() const; diff --git a/mediafileinfo.h b/mediafileinfo.h index 2792a06..652ba4e 100644 --- a/mediafileinfo.h +++ b/mediafileinfo.h @@ -45,8 +45,8 @@ enum class ParsingStatus : std::uint8_t { class TAG_PARSER_EXPORT MediaFileInfo : public BasicFileInfo { public: // constructor, destructor - MediaFileInfo(); - MediaFileInfo(const std::string &path); + explicit MediaFileInfo(); + explicit MediaFileInfo(const std::string &path); MediaFileInfo(const MediaFileInfo &) = delete; MediaFileInfo &operator=(const MediaFileInfo &) = delete; ~MediaFileInfo() override; diff --git a/positioninset.h b/positioninset.h index c8353cf..8aaf4c9 100644 --- a/positioninset.h +++ b/positioninset.h @@ -20,7 +20,7 @@ namespace TagParser { */ class TAG_PARSER_EXPORT PositionInSet { public: - constexpr PositionInSet(std::int32_t position = 0, std::int32_t total = 0); + constexpr explicit PositionInSet(std::int32_t position = 0, std::int32_t total = 0); template > * = nullptr> PositionInSet(const StringType &numericString); diff --git a/progressfeedback.h b/progressfeedback.h index 04a55d2..17a8226 100644 --- a/progressfeedback.h +++ b/progressfeedback.h @@ -14,8 +14,8 @@ template class BasicProgressFeedback { public: using Callback = std::function; - BasicProgressFeedback(const Callback &callback, const Callback &percentageOnlyCallback = Callback()); - BasicProgressFeedback(Callback &&callback, Callback &&percentageOnlyCallback = Callback()); + explicit BasicProgressFeedback(const Callback &callback, const Callback &percentageOnlyCallback = Callback()); + explicit BasicProgressFeedback(Callback &&callback, Callback &&percentageOnlyCallback = Callback()); const std::string &step() const; std::uint8_t stepPercentage() const; diff --git a/tagtarget.h b/tagtarget.h index a91e82c..234474c 100644 --- a/tagtarget.h +++ b/tagtarget.h @@ -22,7 +22,7 @@ public: using IdType = std::uint64_t; using IdContainerType = std::vector; - TagTarget(std::uint64_t level = 0, IdContainerType tracks = IdContainerType(), IdContainerType chapters = IdContainerType(), + explicit TagTarget(std::uint64_t level = 0, IdContainerType tracks = IdContainerType(), IdContainerType chapters = IdContainerType(), IdContainerType editions = IdContainerType(), IdContainerType attachments = IdContainerType()); std::uint64_t level() const; diff --git a/tagvalue.h b/tagvalue.h index 24fcb36..0eb8789 100644 --- a/tagvalue.h +++ b/tagvalue.h @@ -75,19 +75,21 @@ enum class TagValueComparisionFlags : unsigned int { class TAG_PARSER_EXPORT TagValue { public: // constructor, destructor - TagValue(); - TagValue(const char *text, std::size_t textSize, TagTextEncoding textEncoding = TagTextEncoding::Latin1, + explicit TagValue(); + explicit TagValue(const char *text, std::size_t textSize, TagTextEncoding textEncoding = TagTextEncoding::Latin1, TagTextEncoding convertTo = TagTextEncoding::Unspecified); - TagValue(const char *text, TagTextEncoding textEncoding = TagTextEncoding::Latin1, TagTextEncoding convertTo = TagTextEncoding::Unspecified); - TagValue( + explicit TagValue( + const char *text, TagTextEncoding textEncoding = TagTextEncoding::Latin1, TagTextEncoding convertTo = TagTextEncoding::Unspecified); + explicit TagValue( const std::string &text, TagTextEncoding textEncoding = TagTextEncoding::Latin1, TagTextEncoding convertTo = TagTextEncoding::Unspecified); - TagValue(int value); - TagValue(const char *data, std::size_t length, TagDataType type = TagDataType::Undefined, TagTextEncoding encoding = TagTextEncoding::Latin1); - TagValue(std::unique_ptr &&data, std::size_t length, TagDataType type = TagDataType::Binary, + explicit TagValue(int value); + explicit TagValue( + const char *data, std::size_t length, TagDataType type = TagDataType::Undefined, TagTextEncoding encoding = TagTextEncoding::Latin1); + explicit TagValue(std::unique_ptr &&data, std::size_t length, TagDataType type = TagDataType::Binary, TagTextEncoding encoding = TagTextEncoding::Latin1); - TagValue(PositionInSet value); - TagValue(CppUtilities::DateTime value); - TagValue(CppUtilities::TimeSpan value); + explicit TagValue(PositionInSet value); + explicit TagValue(CppUtilities::DateTime value); + explicit TagValue(CppUtilities::TimeSpan value); TagValue(const TagValue &other); TagValue(TagValue &&other) = default; ~TagValue();