Skip to content

Commit

Permalink
Merge pull request #10205 from 9999years/final-matchers
Browse files Browse the repository at this point in the history
Make `Matcher` subclasses `final`
  • Loading branch information
edolstra authored Mar 12, 2024
2 parents 18b89ca + db9bab2 commit bff5c94
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/nix/profile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,12 @@ struct CmdProfileInstall : InstallablesCommand, MixDefaultProfile

struct Matcher
{
virtual ~Matcher() { }
virtual std::string getTitle() = 0;
virtual bool matches(const std::string & name, const ProfileElement & element) = 0;
};

struct RegexMatcher : public Matcher
struct RegexMatcher final : public Matcher
{
std::regex regex;
std::string pattern;
Expand All @@ -504,7 +505,7 @@ struct RegexMatcher : public Matcher
}
};

struct StorePathMatcher : public Matcher
struct StorePathMatcher final : public Matcher
{
nix::StorePath storePath;

Expand All @@ -522,7 +523,7 @@ struct StorePathMatcher : public Matcher
}
};

struct NameMatcher : public Matcher
struct NameMatcher final : public Matcher
{
std::string name;

Expand All @@ -540,7 +541,7 @@ struct NameMatcher : public Matcher
}
};

struct AllMatcher : public Matcher
struct AllMatcher final : public Matcher
{
std::string getTitle() override
{
Expand Down

0 comments on commit bff5c94

Please sign in to comment.