cmExportSetMap.cxx 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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 "cmExportSet.h"
  12. cmExportSet* cmExportSetMap::operator[](const std::string &name)
  13. {
  14. std::map<std::string, cmExportSet*>::iterator it = this->find(name);
  15. if (it == this->end()) // Export set not found
  16. {
  17. it = this->insert(std::make_pair(name, new cmExportSet(name))).first;
  18. }
  19. return it->second;
  20. }
  21. cmExportSetMap::~cmExportSetMap()
  22. {
  23. for(std::map<std::string, cmExportSet*>::iterator it = this->begin();
  24. it != this->end();
  25. ++ it)
  26. {
  27. delete it->second;
  28. }
  29. }