From c67b82c998d92db285ebfe5870435a0d231cb149 Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Mon, 27 Jun 2022 08:49:25 +0400 Subject: cmFindPackageCommand: Enclose file list generators into anonymous ns --- Source/cmFindPackageCommand.cxx | 49 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 99c4b4e..55f699b 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -54,7 +54,6 @@ #endif class cmExecutionStatus; -class cmFileList; namespace { @@ -2147,6 +2146,9 @@ void cmFindPackageCommand::StoreVersionFound() } } +namespace { +class cmFileList; + class cmFileListGeneratorBase { public: @@ -2188,27 +2190,6 @@ private: cmFileListGeneratorBase* Last = nullptr; }; -class cmFindPackageFileList : public cmFileList -{ -public: - cmFindPackageFileList(cmFindPackageCommand* fpc, bool use_suffixes = true) - : FPC(fpc) - , UseSuffixes(use_suffixes) - { - } - -private: - bool Visit(std::string const& fullPath) override - { - if (this->UseSuffixes) { - return this->FPC->SearchDirectory(fullPath); - } - return this->FPC->CheckDirectory(fullPath); - } - cmFindPackageCommand* FPC; - bool UseSuffixes; -}; - bool cmFileListGeneratorBase::Search(cmFileList& listing) { return this->Search(std::string{}, listing); @@ -2240,7 +2221,30 @@ bool cmFileListGeneratorBase::IsIgnoredEntry(const char* const fname) return fname[0] == '.' && (fname[1] == 0 || (fname[1] == '.' && fname[2] == 0)); } +} // anonymous namespace + +class cmFindPackageFileList : public cmFileList +{ +public: + cmFindPackageFileList(cmFindPackageCommand* fpc, bool use_suffixes = true) + : FPC(fpc) + , UseSuffixes(use_suffixes) + { + } + +private: + bool Visit(std::string const& fullPath) override + { + if (this->UseSuffixes) { + return this->FPC->SearchDirectory(fullPath); + } + return this->FPC->CheckDirectory(fullPath); + } + cmFindPackageCommand* FPC; + bool UseSuffixes; +}; +namespace { class cmFileListGeneratorFixed : public cmFileListGeneratorBase { public: @@ -2492,6 +2496,7 @@ private: return cm::make_unique(*this); } }; +} // anonymous namespace bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) { -- cgit v0.12