mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-11 20:11:10 -05:00
cmVisualStudio10TargetGenerator: Remove uses of const_cast
This commit is contained in:
@@ -1449,7 +1449,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
|
|||||||
std::vector<cmGeneratorTarget::AllConfigSource> const& sources =
|
std::vector<cmGeneratorTarget::AllConfigSource> const& sources =
|
||||||
this->GeneratorTarget->GetAllConfigSources();
|
this->GeneratorTarget->GetAllConfigSources();
|
||||||
|
|
||||||
std::set<cmSourceGroup*> groupsUsed;
|
std::set<cmSourceGroup const*> groupsUsed;
|
||||||
for (cmGeneratorTarget::AllConfigSource const& si : sources) {
|
for (cmGeneratorTarget::AllConfigSource const& si : sources) {
|
||||||
std::string const& source = si.Source->GetFullPath();
|
std::string const& source = si.Source->GetFullPath();
|
||||||
cmSourceGroup* sourceGroup =
|
cmSourceGroup* sourceGroup =
|
||||||
@@ -1534,13 +1534,13 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
|
|||||||
{
|
{
|
||||||
Elem e1(e0, "ItemGroup");
|
Elem e1(e0, "ItemGroup");
|
||||||
e1.SetHasElements();
|
e1.SetHasElements();
|
||||||
std::vector<cmSourceGroup*> groupsVec(groupsUsed.begin(),
|
std::vector<cmSourceGroup const*> groupsVec(groupsUsed.begin(),
|
||||||
groupsUsed.end());
|
groupsUsed.end());
|
||||||
std::sort(groupsVec.begin(), groupsVec.end(),
|
std::sort(groupsVec.begin(), groupsVec.end(),
|
||||||
[](cmSourceGroup* l, cmSourceGroup* r) {
|
[](cmSourceGroup const* l, cmSourceGroup const* r) {
|
||||||
return l->GetFullName() < r->GetFullName();
|
return l->GetFullName() < r->GetFullName();
|
||||||
});
|
});
|
||||||
for (cmSourceGroup* sg : groupsVec) {
|
for (cmSourceGroup const* sg : groupsVec) {
|
||||||
std::string const& name = sg->GetFullName();
|
std::string const& name = sg->GetFullName();
|
||||||
if (!name.empty()) {
|
if (!name.empty()) {
|
||||||
std::string guidName = "SG_Filter_" + name;
|
std::string guidName = "SG_Filter_" + name;
|
||||||
@@ -1572,7 +1572,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
|
|||||||
|
|
||||||
// Add to groupsUsed empty source groups that have non-empty children.
|
// Add to groupsUsed empty source groups that have non-empty children.
|
||||||
void cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
|
void cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
|
||||||
std::set<cmSourceGroup*>& groupsUsed,
|
std::set<cmSourceGroup const*>& groupsUsed,
|
||||||
const std::vector<cmSourceGroup>& allGroups)
|
const std::vector<cmSourceGroup>& allGroups)
|
||||||
{
|
{
|
||||||
for (cmSourceGroup const& current : allGroups) {
|
for (cmSourceGroup const& current : allGroups) {
|
||||||
@@ -1583,8 +1583,7 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
|
|||||||
|
|
||||||
this->AddMissingSourceGroups(groupsUsed, children);
|
this->AddMissingSourceGroups(groupsUsed, children);
|
||||||
|
|
||||||
cmSourceGroup* current_ptr = const_cast<cmSourceGroup*>(¤t);
|
if (groupsUsed.find(¤t) != groupsUsed.end()) {
|
||||||
if (groupsUsed.find(current_ptr) != groupsUsed.end()) {
|
|
||||||
continue; // group has already been added to set
|
continue; // group has already been added to set
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1592,8 +1591,7 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
|
|||||||
// (at least one child must already have been added)
|
// (at least one child must already have been added)
|
||||||
std::vector<cmSourceGroup>::const_iterator child_it = children.begin();
|
std::vector<cmSourceGroup>::const_iterator child_it = children.begin();
|
||||||
while (child_it != children.end()) {
|
while (child_it != children.end()) {
|
||||||
cmSourceGroup* child_ptr = const_cast<cmSourceGroup*>(&(*child_it));
|
if (groupsUsed.find(&(*child_it)) != groupsUsed.end()) {
|
||||||
if (groupsUsed.find(child_ptr) != groupsUsed.end()) {
|
|
||||||
break; // found a child that was already added => add current group too
|
break; // found a child that was already added => add current group too
|
||||||
}
|
}
|
||||||
child_it++;
|
child_it++;
|
||||||
@@ -1603,7 +1601,7 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
|
|||||||
continue; // no descendants have source files => ignore this group
|
continue; // no descendants have source files => ignore this group
|
||||||
}
|
}
|
||||||
|
|
||||||
groupsUsed.insert(current_ptr);
|
groupsUsed.insert(¤t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ private:
|
|||||||
void WriteGroupSources(Elem& e0, std::string const& name,
|
void WriteGroupSources(Elem& e0, std::string const& name,
|
||||||
ToolSources const& sources,
|
ToolSources const& sources,
|
||||||
std::vector<cmSourceGroup>&);
|
std::vector<cmSourceGroup>&);
|
||||||
void AddMissingSourceGroups(std::set<cmSourceGroup*>& groupsUsed,
|
void AddMissingSourceGroups(std::set<cmSourceGroup const*>& groupsUsed,
|
||||||
const std::vector<cmSourceGroup>& allGroups);
|
const std::vector<cmSourceGroup>& allGroups);
|
||||||
bool IsResxHeader(const std::string& headerFile);
|
bool IsResxHeader(const std::string& headerFile);
|
||||||
bool IsXamlHeader(const std::string& headerFile);
|
bool IsXamlHeader(const std::string& headerFile);
|
||||||
|
|||||||
Reference in New Issue
Block a user