cmPolicies: Replace UNDEFINED bitset with WARN bitset.

Might as well use the existing concept.
This commit is contained in:
Stephen Kelly 2015-06-06 09:40:58 +02:00
parent 1981c9718b
commit 44a8115797
2 changed files with 6 additions and 10 deletions

View File

@ -343,11 +343,6 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
return e.str();
}
cmPolicies::PolicyMap::PolicyMap()
{
this->UNDEFINED.set();
}
cmPolicies::PolicyStatus
cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
{
@ -375,8 +370,8 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id,
cmPolicies::PolicyStatus status)
{
this->UNDEFINED.reset(id);
this->OLD[id] = (status == cmPolicies::OLD);
this->WARN[id] = (status == cmPolicies::WARN);
this->NEW[id] = (status == cmPolicies::NEW);
this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS);
this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED);
@ -384,10 +379,12 @@ void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id,
bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const
{
return !this->UNDEFINED[id];
return this->OLD[id] || this->WARN[id] || this->NEW[id]
|| this->REQUIRED_ALWAYS[id] || this->REQUIRED_IF_USED[id];
}
bool cmPolicies::PolicyMap::IsEmpty() const
{
return !this->UNDEFINED.none();
return this->OLD.none() && this->WARN.none() && this->NEW.none()
&& this->REQUIRED_ALWAYS.none() && this->REQUIRED_IF_USED.none();
}

View File

@ -281,15 +281,14 @@ public:
/** Represent a set of policy values. */
struct PolicyMap
{
PolicyMap();
PolicyStatus Get(PolicyID id) const;
void Set(PolicyID id, PolicyStatus status);
bool IsDefined(PolicyID id) const;
bool IsEmpty() const;
private:
std::bitset<cmPolicies::CMPCOUNT> UNDEFINED;
std::bitset<cmPolicies::CMPCOUNT> OLD;
std::bitset<cmPolicies::CMPCOUNT> WARN;
std::bitset<cmPolicies::CMPCOUNT> NEW;
std::bitset<cmPolicies::CMPCOUNT> REQUIRED_IF_USED;
std::bitset<cmPolicies::CMPCOUNT> REQUIRED_ALWAYS;