00001 00009 #include "ReasonFlags.h" 00010 00011 #include <bitset> 00012 using namespace std; 00013 00015 00016 struct CPKIFReasonFlagsImpl 00017 { 00018 enum {UNUSED, KEYCOMPROMISE, CACOMPROMISE, AFFILCHANGED, SUPERSEDED, 00019 CESSOFOPER,CERTHOLD,PRIVWITHDRAWN, AACOMPROMISE}; 00020 std::bitset<9> m_reasonFlags; 00021 }; 00022 00024 00032 CPKIFReasonFlags::CPKIFReasonFlags() 00033 :m_impl (new CPKIFReasonFlagsImpl) 00034 { 00035 } 00043 CPKIFReasonFlags::~CPKIFReasonFlags() 00044 { 00045 if(m_impl) 00046 { 00047 delete m_impl; 00048 m_impl = 0; 00049 } 00050 } 00058 bool CPKIFReasonFlags::GetUnused() const 00059 { 00060 return m_impl->m_reasonFlags[CPKIFReasonFlagsImpl::UNUSED]; 00061 } 00069 bool CPKIFReasonFlags::GetKeyCompromise() const 00070 { 00071 return m_impl->m_reasonFlags[CPKIFReasonFlagsImpl::KEYCOMPROMISE]; 00072 } 00080 bool CPKIFReasonFlags::GetCACompromise() const 00081 { 00082 return m_impl->m_reasonFlags[CPKIFReasonFlagsImpl::CACOMPROMISE]; 00083 } 00091 bool CPKIFReasonFlags::GetAffiliationChanged() const 00092 { 00093 return m_impl->m_reasonFlags[CPKIFReasonFlagsImpl::AFFILCHANGED]; 00094 } 00102 bool CPKIFReasonFlags::GetSuperseded() const 00103 { 00104 return m_impl->m_reasonFlags[CPKIFReasonFlagsImpl::SUPERSEDED]; 00105 } 00113 bool CPKIFReasonFlags::GetCessationOfOperation() const 00114 { 00115 return m_impl->m_reasonFlags[CPKIFReasonFlagsImpl::CESSOFOPER]; 00116 } 00124 bool CPKIFReasonFlags::GetCertificateHold() const 00125 { 00126 return m_impl->m_reasonFlags[CPKIFReasonFlagsImpl::CERTHOLD]; 00127 } 00135 bool CPKIFReasonFlags::GetPrivilegeWithdrawn() const 00136 { 00137 return m_impl->m_reasonFlags[CPKIFReasonFlagsImpl::PRIVWITHDRAWN]; 00138 } 00146 bool CPKIFReasonFlags::GetAACompromise() const 00147 { 00148 return m_impl->m_reasonFlags[CPKIFReasonFlagsImpl::AACOMPROMISE]; 00149 } 00157 void CPKIFReasonFlags::SetUnused() 00158 { 00159 m_impl->m_reasonFlags.set(CPKIFReasonFlagsImpl::UNUSED); 00160 } 00168 void CPKIFReasonFlags::SetKeyCompromise() 00169 { 00170 m_impl->m_reasonFlags.set(CPKIFReasonFlagsImpl::KEYCOMPROMISE); 00171 } 00179 void CPKIFReasonFlags::SetCACompromise() 00180 { 00181 m_impl->m_reasonFlags.set(CPKIFReasonFlagsImpl::CACOMPROMISE); 00182 } 00190 void CPKIFReasonFlags::SetAffiliationChanged() 00191 { 00192 m_impl->m_reasonFlags.set(CPKIFReasonFlagsImpl::AFFILCHANGED); 00193 } 00201 void CPKIFReasonFlags::SetSuperseded() 00202 { 00203 m_impl->m_reasonFlags.set(CPKIFReasonFlagsImpl::SUPERSEDED); 00204 } 00212 void CPKIFReasonFlags::SetCessationOfOperation() 00213 { 00214 m_impl->m_reasonFlags.set(CPKIFReasonFlagsImpl::CESSOFOPER); 00215 } 00223 void CPKIFReasonFlags::SetCertificateHold() 00224 { 00225 m_impl->m_reasonFlags.set(CPKIFReasonFlagsImpl::CERTHOLD); 00226 } 00234 void CPKIFReasonFlags::SetPrivilegeWithdrawn() 00235 { 00236 m_impl->m_reasonFlags.set(CPKIFReasonFlagsImpl::PRIVWITHDRAWN); 00237 } 00245 void CPKIFReasonFlags::SetAACompromise() 00246 { 00247 m_impl->m_reasonFlags.set(CPKIFReasonFlagsImpl::AACOMPROMISE); 00248 } 00249