cmExportSetMap.cxx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmExportSetMap.h"
  11. #include "cmAlgorithms.h"
  12. #include "cmExportSet.h"
  13. #include <utility>
  14. cmExportSet* cmExportSetMap::operator[](const std::string& name)
  15. {
  16. std::map<std::string, cmExportSet*>::iterator it = this->find(name);
  17. if (it == this->end()) // Export set not found
  18. {
  19. it = this->insert(std::make_pair(name, new cmExportSet(name))).first;
  20. }
  21. return it->second;
  22. }
  23. void cmExportSetMap::clear()
  24. {
  25. cmDeleteAll(*this);
  26. this->derived::clear();
  27. }
  28. cmExportSetMap::~cmExportSetMap()
  29. {
  30. this->clear();
  31. }