add 'nf7::' prefix to flags of File::TypeInfo

This commit is contained in:
2022-08-15 00:29:03 +09:00
parent ed970d45c6
commit 0f5e3c6246
15 changed files with 40 additions and 33 deletions

View File

@@ -54,7 +54,9 @@ class GenericTypeInfo : public File::TypeInfo {
private:
static std::unordered_set<std::string> AddFlags(
std::unordered_set<std::string>&& flags) noexcept {
if (std::is_constructible<T, Env&>::value) flags.insert("File_Factory");
if (std::is_constructible<T, Env&>::value) {
flags.insert("nf7::File::TypeInfo::Factory");
}
return flags;
}
};

View File

@@ -25,11 +25,14 @@ bool FileFactory::Update() noexcept {
for (const auto& reg : nf7::File::registry()) {
const auto& t = *reg.second;
const bool name_match =
type_filter_.empty() || t.name().find(type_filter_) != std::string::npos;
const bool match =
t.flags().contains("nf7::File::TypeInfo::Factory") &&
(type_filter_.empty() ||
t.name().find(type_filter_) != std::string::npos) &&
filter_(t);
const bool sel = (type_ == &t);
if (!name_match || !filter_(t)) {
if (!match) {
if (sel) type_ = nullptr;
continue;
}