summaryrefslogtreecommitdiffstats
path: root/Source/cmPolicies.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-05-03 08:12:34 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-05-04 20:32:21 (GMT)
commit013ada80eac9cb119a6288ee58724a8c9915a35c (patch)
tree04739c03393e31427fae0acbca7057c97ffb41e9 /Source/cmPolicies.cxx
parentbe6664c208c65e01dc175ae4d27e7fc18c28c97e (diff)
downloadCMake-013ada80eac9cb119a6288ee58724a8c9915a35c.zip
CMake-013ada80eac9cb119a6288ee58724a8c9915a35c.tar.gz
CMake-013ada80eac9cb119a6288ee58724a8c9915a35c.tar.bz2
cmPolicies: Implement PolicyMap in terms of bitset.
Diffstat (limited to 'Source/cmPolicies.cxx')
-rw-r--r--Source/cmPolicies.cxx35
1 files changed, 31 insertions, 4 deletions
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 8996943..f8d61db 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -343,24 +343,51 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
return e.str();
}
+cmPolicies::PolicyMap::PolicyMap()
+{
+ this->UNDEFINED.set();
+}
+
cmPolicies::PolicyStatus
cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
{
- return this->find(id)->second;
+ PolicyStatus status = cmPolicies::WARN;
+
+ if (this->OLD[id])
+ {
+ status = cmPolicies::OLD;
+ }
+ else if (this->NEW[id])
+ {
+ status = cmPolicies::NEW;
+ }
+ else if (this->REQUIRED_ALWAYS[id])
+ {
+ status = cmPolicies::REQUIRED_ALWAYS;
+ }
+ else if (this->REQUIRED_IF_USED[id])
+ {
+ status = cmPolicies::REQUIRED_IF_USED;
+ }
+ return status;
}
void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id,
cmPolicies::PolicyStatus status)
{
- (*this)[id] = status;
+ this->UNDEFINED.reset(id);
+ this->OLD[id] = (status == cmPolicies::OLD);
+ this->NEW[id] = (status == cmPolicies::NEW);
+ this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS);
+ this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED);
}
bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const
{
- return this->find(id) != this->end();
+ return !this->UNDEFINED[id];
}
bool cmPolicies::PolicyMap::IsEmpty() const
{
- return this->empty();
+ return !this->UNDEFINED.none();
}