diff --git a/include/loot/plugin_interface.h b/include/loot/plugin_interface.h index 1d7621ac..dc152a01 100644 --- a/include/loot/plugin_interface.h +++ b/include/loot/plugin_interface.h @@ -80,7 +80,7 @@ public: * @return A set of Bash Tags. The order of elements in the set holds no * semantics. */ - virtual std::vector GetBashTags() const = 0; + virtual std::vector GetBashTags() const = 0; /** * Get the plugin's CRC-32 checksum. diff --git a/src/api/helpers/text.cpp b/src/api/helpers/text.cpp index 019b6911..e49abb4b 100644 --- a/src/api/helpers/text.cpp +++ b/src/api/helpers/text.cpp @@ -57,21 +57,19 @@ constexpr std::string_view pseudosemVersionRegex = 'v' or 'version:. */ constexpr std::string_view digitsVersionRegex = R"((?:^|v|version:\s*)(\d+))"sv; -std::vector ExtractBashTags(std::string_view description) { - std::vector tags; - +std::vector ExtractBashTags(std::string_view description) { static constexpr std::string_view BASH_TAGS_OPENER = "{{BASH:"sv; size_t startPos = description.find("{{BASH:"); if (startPos == std::string::npos || startPos + BASH_TAGS_OPENER.length() >= description.length()) { - return tags; + return {}; } startPos += BASH_TAGS_OPENER.length(); const size_t endPos = description.find("}}", startPos); if (endPos == std::string::npos) { - return tags; + return {}; } auto commaSeparatedTags = description.substr(startPos, endPos - startPos); @@ -81,10 +79,9 @@ std::vector ExtractBashTags(std::string_view description) { for (auto& tag : bashTags) { boost::trim(tag); - tags.push_back(Tag(tag)); } - return tags; + return bashTags; } std::optional ExtractVersion(std::string_view text) { diff --git a/src/api/helpers/text.h b/src/api/helpers/text.h index fdf39af1..ff07f04e 100644 --- a/src/api/helpers/text.h +++ b/src/api/helpers/text.h @@ -46,7 +46,7 @@ typedef std::wstring ComparableFilename; typedef icu::UnicodeString ComparableFilename; #endif -std::vector ExtractBashTags(std::string_view description); +std::vector ExtractBashTags(std::string_view description); std::optional ExtractVersion(std::string_view text); diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index 81059d8e..8f9df4f2 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -340,7 +340,7 @@ std::vector Plugin::GetMasters() const { return mastersVec; } -std::vector Plugin::GetBashTags() const { return tags_; } +std::vector Plugin::GetBashTags() const { return tags_; } std::optional Plugin::GetCRC() const { return crc_; } diff --git a/src/api/plugin.h b/src/api/plugin.h index c1e540b6..b8059cbd 100644 --- a/src/api/plugin.h +++ b/src/api/plugin.h @@ -63,7 +63,7 @@ public: std::optional GetHeaderVersion() const override; std::optional GetVersion() const override; std::vector GetMasters() const override; - std::vector GetBashTags() const override; + std::vector GetBashTags() const override; std::optional GetCRC() const override; bool IsMaster() const override; @@ -110,7 +110,7 @@ private: // header? std::optional version_; // Obtained from description field. std::optional crc_; - std::vector tags_; + std::vector tags_; std::vector archivePaths_; std::map> archiveAssets_; }; diff --git a/src/tests/api/internals/helpers/text_test.h b/src/tests/api/internals/helpers/text_test.h index 5eacfb70..c1c9df5b 100644 --- a/src/tests/api/internals/helpers/text_test.h +++ b/src/tests/api/internals/helpers/text_test.h @@ -46,23 +46,23 @@ Requires Skyrim Special Edition 1.5.39 or greater. auto tags = ExtractBashTags(description); - std::vector expectedTags({ - Tag("C.Climate"), - Tag("C.Encounter"), - Tag("C.ImageSpace"), - Tag("C.Light"), - Tag("C.Location"), - Tag("C.Music"), - Tag("C.Name"), - Tag("C.Owner"), - Tag("C.Water"), - Tag("Delev"), - Tag("Graphics"), - Tag("Invent"), - Tag("Names"), - Tag("Relev"), - Tag("Sound"), - Tag("Stats"), + std::vector expectedTags({ + "C.Climate", + "C.Encounter", + "C.ImageSpace", + "C.Light", + "C.Location", + "C.Music", + "C.Name", + "C.Owner", + "C.Water", + "Delev", + "Graphics", + "Invent", + "Names", + "Relev", + "Sound", + "Stats", }); EXPECT_EQ(expectedTags, tags); diff --git a/src/tests/api/internals/plugin_test.h b/src/tests/api/internals/plugin_test.h index fe250cea..a632bb67 100644 --- a/src/tests/api/internals/plugin_test.h +++ b/src/tests/api/internals/plugin_test.h @@ -164,7 +164,7 @@ public: std::vector GetMasters() const override { return masters_; } - std::vector GetBashTags() const override { return std::vector(); } + std::vector GetBashTags() const override { return {}; } std::optional GetCRC() const override { return std::optional();