Heres an enum in C++/CLI that I am using to determine if columns on a grid have changed
[Flags] enum class m_FlagBits
{
EXPIRY_ID = 1,
DESCRIPTION = 2,
EXPIRY_TYPE = 4,
UNIT_ID = 8,
FIXED_INTERVAL_ID = 16,
DAY = 32,
NUMBER_OF_INTERVAL_UNITS = 64,
VALID_FROM = 128,
VALID_TO = 256
};
m_FlagBits m_ElementList;
Make sure none of the values are set when I enter a row:
m_ElementList = m_ElementList & ~ m_FlagBits::EXPIRY_ID;
m_ElementList = m_ElementList & ~ m_FlagBits::EXPIRY_TYPE;
m_ElementList = m_ElementList & ~ m_FlagBits::DESCRIPTION;
m_ElementList = m_ElementList & ~ m_FlagBits::UNIT_ID;
m_ElementList = m_ElementList & ~ m_FlagBits::DAY;
m_ElementList = m_ElementList & ~ m_FlagBits::NUMBER_OF_INTERVAL_UNITS;
m_ElementList = m_ElementList & ~ m_FlagBits::FIXED_INTERVAL_ID;
m_ElementList = m_ElementList & ~ m_FlagBits::VALID_FROM;
m_ElementList = m_ElementList & ~ m_FlagBits::VALID_TO;
Setting one of them after changing a value:
m_ElementList = m_ElementList | m_FlagBits::EXPIRY_ID;
Checking if one of them has been used
if (static_cast<int>(m_ElementList) & static_cast<int>(m_FlagBits::EXPIRY_ID))
{
}