1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2013 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmVisualStudioSlnData.h"
14 //----------------------------------------------------------------------------
15 const cmSlnProjectEntry*
16 cmSlnData::GetProjectByGUID(const std::string& projectGUID) const
18 ProjectStorage::const_iterator it(ProjectsByGUID.find(projectGUID));
19 if (it != ProjectsByGUID.end())
25 //----------------------------------------------------------------------------
26 const cmSlnProjectEntry*
27 cmSlnData::GetProjectByName(const std::string& projectName) const
29 ProjectStringIndex::const_iterator it(ProjectNameIndex.find(projectName));
30 if (it != ProjectNameIndex.end())
31 return &it->second->second;
36 //----------------------------------------------------------------------------
37 std::vector<cmSlnProjectEntry> cmSlnData::GetProjects() const
39 ProjectStringIndex::const_iterator it(this->ProjectNameIndex.begin()),
40 itEnd(this->ProjectNameIndex.end());
41 std::vector<cmSlnProjectEntry> result;
42 for (; it != itEnd; ++it)
43 result.push_back(it->second->second);
47 //----------------------------------------------------------------------------
48 cmSlnProjectEntry* cmSlnData::AddProject(
49 const std::string& projectGUID,
50 const std::string& projectName,
51 const std::string& projectRelativePath)
53 ProjectStorage::iterator it(ProjectsByGUID.find(projectGUID));
54 if (it != ProjectsByGUID.end())
56 it = ProjectsByGUID.insert(
57 ProjectStorage::value_type(
59 cmSlnProjectEntry(projectGUID, projectName, projectRelativePath))).first;
60 ProjectNameIndex[projectName] = it;