CFlagsProperty: Make use of a ranged for loop
@@ -5,7 +5,7 @@ void CFlagsProperty::Serialize(IArchive& rArc)
{
TSerializeableTypedProperty::Serialize(rArc);
- CFlagsProperty* pArchetype = static_cast<CFlagsProperty*>(mpArchetype);
+ auto* pArchetype = static_cast<CFlagsProperty*>(mpArchetype);
if (!pArchetype || !rArc.CanSkipParameters() || mBitFlags != pArchetype->mBitFlags)
{
@@ -20,8 +20,8 @@ void CFlagsProperty::PostInitialize()
// Create AllFlags mask
mAllFlags = 0;
- for (int FlagIdx = 0; FlagIdx < mBitFlags.size(); FlagIdx++)
- mAllFlags |= mBitFlags[FlagIdx].Mask;
+ for (const auto& flag : mBitFlags)
+ mAllFlags |= flag.Mask;
}
void CFlagsProperty::SerializeValue(void* pData, IArchive& rArc) const
@@ -32,7 +32,7 @@ void CFlagsProperty::SerializeValue(void* pData, IArchive& rArc) const
void CFlagsProperty::InitFromArchetype(IProperty* pOther)
{
TSerializeableTypedProperty::InitFromArchetype(pOther);
- CFlagsProperty* pOtherFlags = static_cast<CFlagsProperty*>(pOther);
+ auto* pOtherFlags = static_cast<CFlagsProperty*>(pOther);
mBitFlags = pOtherFlags->mBitFlags;
mAllFlags = pOtherFlags->mAllFlags;
}
@@ -48,6 +48,8 @@ TString CFlagsProperty::ValueAsString(void* pData) const
*/
uint32 CFlagsProperty::HasValidValue(void* pPropertyData)
{
- if (!mAllFlags) return 0;
+ if (!mAllFlags)
+ return 0;
+
return ValueRef(pPropertyData) & ~mAllFlags;
}
