Beispiel #1
0
string TarsAnalyzer::tostrMap(const MapPtr &pPtr, bool bNew)
{
    string s = Builtin::builtinTable[Builtin::KindMap] + string("<") + tostr(pPtr->getLeftTypePtr()) + ", " + tostr(pPtr->getRightTypePtr());
    if(MapPtr::dynamicCast(pPtr->getRightTypePtr()) || VectorPtr::dynamicCast(pPtr->getRightTypePtr()))
    {
        s += " >";
    }
    else
    {
        s += ">";
    }
    return s;
}
Beispiel #2
0
int TarsAnalyzer::readMap(MapPtr pPtr, int expectTag, bool isRequire)
{

    int type;
    AnalyzerDataHead h;
    h.readFrom(*this);
    
    uint8_t tag = h.getTag();
    
    int ret = compareTag(tag, expectTag,isRequire);
    if (ret != eOK)
    {
        return 0;
    }
    switch (h.getType())
    {
    case AnalyzerDataHead::eMap:
        {
            int size;
            uint8_t t = 0;
            read(size, t, type);
            
            cout << "read " << " map size:" << size << endl;
            if (size < 0|| size > 10 * 1024 * 1024)
            {
                cout<< getTab() << "ERROR, invalid size " << size << endl;
                cout << getTab() << " _cur:" << _cur << " _last_pos:" << _last_pos ;
                exit(-1);
            }
            //addTab(7);
            cout << getTab()<< "{ //tag:" << (int)tag << endl;
            for (int i = 0; i < size; ++i)
            {
            
            cout  << getTab() << " index:" << i << " first:";
                readType(pPtr->getLeftTypePtr(), 0,  isRequire);
                cout<< getTab()<< " index:" << i << " second:" ;
                readType(pPtr->getRightTypePtr(), 1,  isRequire);

            }
            
            cout << getTab()<< "} //tag:" << (int)tag << endl;
            //eraseTab(7);
        }
        break;
    default:
        {
            cout << "ERROR, read map type mismatch, tag:" <<  (int)tag <<"get type " << h.tostrType(h.getType() )<< endl;
            cout << getTab() << " _cur:" << _cur << " _last_pos:" << _last_pos << endl;;
            exit(-1);
        }
    }
    
    return 0;

}
Beispiel #3
0
/*******************************MapPtr********************************/
string Jce2Php::tostrMap(const MapPtr &pPtr) const
{
    string s = string("c_map (new ") + tostr(pPtr->getLeftTypePtr()) + ",new " + tostr(pPtr->getRightTypePtr()) + string(")");
    return s;
}