bool STObject::clearFlag (uint32 f)
{
    STUInt32* t = dynamic_cast<STUInt32*> (getPField (sfFlags));

    if (!t)
        return false;

    t->setValue (t->getValue () & ~f);
    return true;
}
Esempio n. 2
0
bool STObject::setFlag (std::uint32_t f)
{
    STUInt32* t = dynamic_cast<STUInt32*> (getPField (sfFlags, true));

    if (!t)
        return false;

    t->setValue (t->getValue () | f);
    return true;
}
void STObject::setFieldU32 (SField::ref field, uint32 v)
{
    SerializedType* rf = getPField (field, true);

    if (!rf) throw std::runtime_error ("Field not found");

    if (rf->getSType () == STI_NOTPRESENT) rf = makeFieldPresent (field);

    STUInt32* cf = dynamic_cast<STUInt32*> (rf);

    if (!cf) throw std::runtime_error ("Wrong field type");

    cf->setValue (v);
}