diff options
Diffstat (limited to 'Source/cmExportSet.h')
-rw-r--r-- | Source/cmExportSet.h | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h index 58ad617d4..f0d921f5e 100644 --- a/Source/cmExportSet.h +++ b/Source/cmExportSet.h @@ -5,6 +5,8 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include <map> +#include <memory> #include <string> #include <vector> @@ -17,24 +19,24 @@ class cmExportSet { public: /// Construct an empty export set named \a name - cmExportSet(const std::string& name) - : Name(name) - { - } + cmExportSet(std::string name); /// Destructor ~cmExportSet(); + cmExportSet(const cmExportSet&) = delete; + cmExportSet& operator=(const cmExportSet&) = delete; + void Compute(cmLocalGenerator* lg); - void AddTargetExport(cmTargetExport* tgt); + void AddTargetExport(std::unique_ptr<cmTargetExport> tgt); void AddInstallation(cmInstallExportGenerator const* installation); std::string const& GetName() const { return this->Name; } - std::vector<cmTargetExport*> const* GetTargetExports() const + std::vector<std::unique_ptr<cmTargetExport>> const& GetTargetExports() const { - return &this->TargetExports; + return this->TargetExports; } std::vector<cmInstallExportGenerator const*> const* GetInstallations() const @@ -43,9 +45,21 @@ public: } private: - std::vector<cmTargetExport*> TargetExports; + std::vector<std::unique_ptr<cmTargetExport>> TargetExports; std::string Name; std::vector<cmInstallExportGenerator const*> Installations; }; +/// A name -> cmExportSet map with overloaded operator[]. +class cmExportSetMap : public std::map<std::string, cmExportSet> +{ +public: + /** \brief Overloaded operator[]. + * + * The operator is overloaded because cmExportSet has no default constructor: + * we do not want unnamed export sets. + */ + cmExportSet& operator[](const std::string& name); +}; + #endif |