mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Make PluginInterface::GetBashTags() return std::vector<std::string>
This commit is contained in:
@@ -80,7 +80,7 @@ public:
|
||||
* @return A set of Bash Tags. The order of elements in the set holds no
|
||||
* semantics.
|
||||
*/
|
||||
virtual std::vector<Tag> GetBashTags() const = 0;
|
||||
virtual std::vector<std::string> GetBashTags() const = 0;
|
||||
|
||||
/**
|
||||
* Get the plugin's CRC-32 checksum.
|
||||
|
||||
@@ -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<Tag> ExtractBashTags(std::string_view description) {
|
||||
std::vector<Tag> tags;
|
||||
|
||||
std::vector<std::string> 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<Tag> ExtractBashTags(std::string_view description) {
|
||||
|
||||
for (auto& tag : bashTags) {
|
||||
boost::trim(tag);
|
||||
tags.push_back(Tag(tag));
|
||||
}
|
||||
|
||||
return tags;
|
||||
return bashTags;
|
||||
}
|
||||
|
||||
std::optional<std::string> ExtractVersion(std::string_view text) {
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef std::wstring ComparableFilename;
|
||||
typedef icu::UnicodeString ComparableFilename;
|
||||
#endif
|
||||
|
||||
std::vector<Tag> ExtractBashTags(std::string_view description);
|
||||
std::vector<std::string> ExtractBashTags(std::string_view description);
|
||||
|
||||
std::optional<std::string> ExtractVersion(std::string_view text);
|
||||
|
||||
|
||||
+1
-1
@@ -340,7 +340,7 @@ std::vector<std::string> Plugin::GetMasters() const {
|
||||
return mastersVec;
|
||||
}
|
||||
|
||||
std::vector<Tag> Plugin::GetBashTags() const { return tags_; }
|
||||
std::vector<std::string> Plugin::GetBashTags() const { return tags_; }
|
||||
|
||||
std::optional<uint32_t> Plugin::GetCRC() const { return crc_; }
|
||||
|
||||
|
||||
+2
-2
@@ -63,7 +63,7 @@ public:
|
||||
std::optional<float> GetHeaderVersion() const override;
|
||||
std::optional<std::string> GetVersion() const override;
|
||||
std::vector<std::string> GetMasters() const override;
|
||||
std::vector<Tag> GetBashTags() const override;
|
||||
std::vector<std::string> GetBashTags() const override;
|
||||
std::optional<uint32_t> GetCRC() const override;
|
||||
|
||||
bool IsMaster() const override;
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
// header?
|
||||
std::optional<std::string> version_; // Obtained from description field.
|
||||
std::optional<uint32_t> crc_;
|
||||
std::vector<Tag> tags_;
|
||||
std::vector<std::string> tags_;
|
||||
std::vector<std::filesystem::path> archivePaths_;
|
||||
std::map<uint64_t, std::set<uint64_t>> archiveAssets_;
|
||||
};
|
||||
|
||||
@@ -46,23 +46,23 @@ Requires Skyrim Special Edition 1.5.39 or greater.
|
||||
|
||||
auto tags = ExtractBashTags(description);
|
||||
|
||||
std::vector<Tag> 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<std::string> 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);
|
||||
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
|
||||
std::vector<std::string> GetMasters() const override { return masters_; }
|
||||
|
||||
std::vector<Tag> GetBashTags() const override { return std::vector<Tag>(); }
|
||||
std::vector<std::string> GetBashTags() const override { return {}; }
|
||||
|
||||
std::optional<uint32_t> GetCRC() const override {
|
||||
return std::optional<uint32_t>();
|
||||
|
||||
Reference in New Issue
Block a user