Exemplo n.º 1
0
void Struct::addTypeId(const TypeIdPtr &typeIdPtr)
{
    StructPtr sp = StructPtr::dynamicCast(typeIdPtr->getTypePtr());
    if(sp)
    {
        if(sp->getSid() == getSid())
        {
            g_parse->error("struct can't take self as member data");
        }
    }

    for(size_t i = 0; i < _members.size(); i++)
    {
        if(_members[i]->getId() == typeIdPtr->getId())
        {
            g_parse->error("data member '" + typeIdPtr->getId() + "' duplicate definition");
        }
        if(_members[i]->getTag() == typeIdPtr->getTag())
        {
            g_parse->error("data member '" + typeIdPtr->getId() + "' has equal tag with '" + _members[i]->getId() + "'");
        }

        if(_members[i]->getTag() > typeIdPtr->getTag())
        {
            _members.insert(_members.begin() + i, typeIdPtr);
            return;
        }
    }

    _members.push_back(typeIdPtr);
}
Exemplo n.º 2
0
string TarsAnalyzer::tostrStruct(const StructPtr &pPtr) const
{
    return pPtr->getSid();
}